MCPcopy Create free account
hub / github.com/coder/envbox / StringArray

Function StringArray

cli/cliflag/cliflag.go:64–74  ·  view source on GitHub ↗
(flagset *pflag.FlagSet, name, shorthand, env string, def []string, usage string)

Source from the content-addressed store, hash-verified

62}
63
64func StringArray(flagset *pflag.FlagSet, name, shorthand, env string, def []string, usage string) {
65 v, ok := os.LookupEnv(env)
66 if !ok || v == "" {
67 if v == "" {
68 def = []string{}
69 } else {
70 def = strings.Split(v, ",")
71 }
72 }
73 flagset.StringArrayP(name, shorthand, def, fmtUsage(usage, env))
74}
75
76func StringArrayVarP(flagset *pflag.FlagSet, ptr *[]string, name string, shorthand string, env string, def []string, usage string) {
77 val, ok := os.LookupEnv(env)

Callers

nothing calls this directly

Calls 1

fmtUsageFunction · 0.85

Tested by

no test coverage detected