diff --git a/bin/es.go b/bin/es.go index c39272b..09c3d58 100644 --- a/bin/es.go +++ b/bin/es.go @@ -114,7 +114,28 @@ func main() { }, Run: func(cmd *cobra.Command, args []string) { - for _, e := range h.Encrypt(envmap.ToMap(args)) { + var env = envmap.Import() + + for k, _ := range env { + + found := false + + for _, e := range args { + + if k == e { + found = true + break + } + + } + + if !found { + delete(env, k) + } + + } + + for _, e := range h.Encrypt(env) { fmt.Println(e) } diff --git a/example/test.sh b/example/test.sh index ddaf223..a9317c5 100755 --- a/example/test.sh +++ b/example/test.sh @@ -1,4 +1,4 @@ -BINARY=../build/darwin_amd64/es-bin +BINARY=../build/darwin-amd64/es export SECRET1=opensesame export SECRET2=foreyesonly @@ -10,4 +10,4 @@ unset SECRET2 eval $(cat test.envs) -$BINARY dec -- /usr/local/bin/ep -v test.config -- /bin/cat test.config +$BINARY dec -- /usr/local/bin/ep -v -d test.config -- /bin/cat test.config