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

Function String

cli/cliflag/cliflag.go:47–53  ·  view source on GitHub ↗

String sets a string flag on the given flag set.

(flagset *pflag.FlagSet, name, shorthand, env, def, usage string)

Source from the content-addressed store, hash-verified

45
46// String sets a string flag on the given flag set.
47func String(flagset *pflag.FlagSet, name, shorthand, env, def, usage string) {
48 v, ok := os.LookupEnv(env)
49 if !ok || v == "" {
50 v = def
51 }
52 flagset.StringP(name, shorthand, v, fmtUsage(usage, env))
53}
54
55// StringVarP sets a string flag on the given flag set.
56func StringVarP(flagset *pflag.FlagSet, p *string, name string, shorthand string, env string, def string, usage string) {

Callers 1

TestCliflagFunction · 0.92

Calls 1

fmtUsageFunction · 0.85

Tested by 1

TestCliflagFunction · 0.74