Skip to content

Commit

Permalink
fix: add OsEnv func to get all os env variable on Key Value format
Browse files Browse the repository at this point in the history
  • Loading branch information
Deny Prasetyo committed Nov 29, 2021
1 parent 905a8c5 commit bb79a92
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions pkg/cmd/lookup.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"log"
"os"
"os/exec"
"strings"
)

func LookPathDefault(executableName string, defaultPath string) (binaryPath string) {
Expand Down Expand Up @@ -36,3 +37,14 @@ func LookupEnv(key string) string {
}
return value
}

func OsEnv() map[string]string {
output := map[string]string{}
for _, env := range os.Environ() {
envPair := strings.SplitN(env, "=", 2)
key := envPair[0]
value := envPair[1]
output[key] = value
}
return output
}

0 comments on commit bb79a92

Please sign in to comment.