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

Function IsSet

cli/cliflag/cliflag.go:37–44  ·  view source on GitHub ↗

IsSet returns the string value of the flag and whether it was set.

(cmd *cobra.Command, name string)

Source from the content-addressed store, hash-verified

35
36// IsSet returns the string value of the flag and whether it was set.
37func IsSet(cmd *cobra.Command, name string) (string, bool) {
38 flag := cmd.Flag(name)
39 if flag == nil {
40 return "", false
41 }
42
43 return flag.Value.String(), flag.Changed
44}
45
46// String sets a string flag on the given flag set.
47func String(flagset *pflag.FlagSet, name, shorthand, env, def, usage string) {

Callers 1

IsSetBoolFunction · 0.85

Calls 1

StringMethod · 0.45

Tested by

no test coverage detected