Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add export functionality #185

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

KonradIT
Copy link

Using an eval function (such as eval $(go run . export) ) it's now possible to export the saved environmental variables to the host shell.

@codecov-io
Copy link

codecov-io commented Apr 25, 2020

Codecov Report

Merging #185 into master will decrease coverage by 0.48%.
The diff coverage is 0.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #185      +/-   ##
==========================================
- Coverage   35.02%   34.54%   -0.49%     
==========================================
  Files          11       12       +1     
  Lines         708      718      +10     
==========================================
  Hits          248      248              
- Misses        418      428      +10     
  Partials       42       42              
Impacted Files Coverage Δ
cli/export.go 0.00% <0.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 24a8f72...3feafb5. Read the comment docs.

@codecov-commenter
Copy link

codecov-commenter commented Jul 13, 2020

Codecov Report

Merging #185 into master will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master     #185   +/-   ##
=======================================
  Coverage   37.93%   37.93%           
=======================================
  Files          13       13           
  Lines         783      783           
=======================================
  Hits          297      297           
  Misses        442      442           
  Partials       44       44           

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 919e33f...a68255b. Read the comment docs.

@@ -77,5 +77,11 @@ var (
flKey,
},
},
{
Name: "export",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is a print subcommand in the tool, which prints envs in various formats. This functionality should be a new print format instead of a new subcommand.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here is the active list of the output formats.

And this is how these can be used:
Screen Shot 2020-07-13 at 9 25 37

Also please make sure that this will print an evaluable format so escaping strings and so on.
For example:

ENVKEY="My custom text including space, =, \"."

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please give the name "envlist" to the new printing format.

if err != nil {
continue
}
fmt.Printf("export %s=\"%s\"\n", key, value)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

using a simple " without escaping is not safe. An env key value can be something that contains a doublequote, for example a singla " so in this case the tool would print KEY=""" which is invalid.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants