[config] preliminary Dockerfile support
This commit is contained in:
@@ -13,6 +13,7 @@ import (
|
||||
func main() {
|
||||
args := flag.NewFlagSet("config:export", flag.ExitOnError)
|
||||
global := args.Bool("global", false, "--global: use the global environment")
|
||||
keys := args.Bool("keys", false, "--keys: export keys only")
|
||||
envfile := args.Bool("envfile", false, "--envfile: export as envfile rather than bash exports")
|
||||
args.Parse(os.Args[2:])
|
||||
|
||||
@@ -32,6 +33,13 @@ func main() {
|
||||
if err != nil {
|
||||
common.LogFail(err.Error())
|
||||
}
|
||||
if *keys {
|
||||
for _, k := range env.Keys() {
|
||||
fmt.Println(k)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
if *envfile {
|
||||
fmt.Println(env.EnvfileString())
|
||||
} else {
|
||||
|
||||
@@ -13,6 +13,7 @@ import (
|
||||
func main() {
|
||||
args := flag.NewFlagSet("config:get", flag.ExitOnError)
|
||||
global := args.Bool("global", false, "--global: use the global environment")
|
||||
quoted := args.Bool("quoted", false, "--quoted: get the value quoted")
|
||||
args.Parse(os.Args[2:])
|
||||
appName := args.Arg(0)
|
||||
nextArg := 0
|
||||
@@ -35,5 +36,10 @@ func main() {
|
||||
common.LogFail(fmt.Sprintf("Unexpected argument(s): %v", args.Args()[nextArg+1:]))
|
||||
}
|
||||
key := args.Arg(nextArg)
|
||||
fmt.Printf("%s", env.GetDefault(key, ""))
|
||||
value := env.GetDefault(key, "")
|
||||
if *quoted {
|
||||
fmt.Printf("'%s'", configenv.SingleQuoteEscape(value))
|
||||
} else {
|
||||
fmt.Printf("%s", value)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user