parent
35fa871fdb
commit
593adb4cdf
3 changed files with 42 additions and 9 deletions
@ -0,0 +1,18 @@ |
||||
package coreutils |
||||
|
||||
import ( |
||||
"fmt" |
||||
"os" |
||||
) |
||||
|
||||
// PrintStrings prints each string in strings on a new line
|
||||
func PrintStrings(strings []string) { |
||||
for _, str := range strings { |
||||
fmt.Println(str) |
||||
} |
||||
} |
||||
|
||||
// PrintEnv prints all environment variables
|
||||
func PrintEnv() { |
||||
PrintStrings(os.Environ()) |
||||
} |
@ -0,0 +1,21 @@ |
||||
package main |
||||
|
||||
import ( |
||||
"flag" |
||||
"os" |
||||
common "source.heropunch.io/tomo/go-coreutils" |
||||
) |
||||
|
||||
var ignoreEnv = flag.Bool( |
||||
"i", |
||||
false, |
||||
"Completely ignore the existing environment and execute cmd only with each (var, value) tuple specified.", |
||||
) |
||||
|
||||
func main() { |
||||
flag.Parse() |
||||
if *ignoreEnv { |
||||
os.Clearenv() |
||||
} |
||||
common.PrintEnv() |
||||
} |
Loading…
Reference in new issue