MCPcopy
hub / github.com/cli/cli / NilStringFlag

Function NilStringFlag

pkg/cmdutil/flags.go:15–17  ·  view source on GitHub ↗

NilStringFlag defines a new flag with a string pointer receiver. This is useful for differentiating between the flag being set to a blank value and the flag not being passed at all.

(cmd *cobra.Command, p **string, name string, shorthand string, usage string)

Source from the content-addressed store, hash-verified

13// NilStringFlag defines a new flag with a string pointer receiver. This is useful for differentiating
14// between the flag being set to a blank value and the flag not being passed at all.
15func NilStringFlag(cmd *cobra.Command, p **string, name string, shorthand string, usage string) *pflag.Flag {
16 return cmd.Flags().VarPF(newStringValue(p), name, shorthand, usage)
17}
18
19// NilBoolFlag defines a new flag with a bool pointer receiver. This is useful for differentiating
20// between the flag being explicitly set to a false value and the flag not being passed at all.

Callers 2

NewCmdEditFunction · 0.92
NewCmdEditFunction · 0.92

Calls 1

newStringValueFunction · 0.85

Tested by

no test coverage detected