From 455b6a683e0d0938011de1bb67e9608c85343da2 Mon Sep 17 00:00:00 2001 From: Joern Barthel Date: Thu, 18 Feb 2016 23:48:41 +0100 Subject: [PATCH] Fixed example and command. --- bin/es.go | 23 ++++++++++++++++++++++- example/test.sh | 4 ++-- 2 files changed, 24 insertions(+), 3 deletions(-) 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