MCPcopy
hub / github.com/cli/cli / NilBoolFlag

Function NilBoolFlag

pkg/cmdutil/flags.go:21–25  ·  view source on GitHub ↗

NilBoolFlag defines a new flag with a bool pointer receiver. This is useful for differentiating between the flag being explicitly set to a false value and the flag not being passed at all.

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

Source from the content-addressed store, hash-verified

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.
21func NilBoolFlag(cmd *cobra.Command, p **bool, name string, shorthand string, usage string) *pflag.Flag {
22 f := cmd.Flags().VarPF(newBoolValue(p), name, shorthand, usage)
23 f.NoOptDefVal = "true"
24 return f
25}
26
27// StringEnumFlag defines a new string flag that only allows values listed in options.
28func StringEnumFlag(cmd *cobra.Command, p *string, name, shorthand, defaultValue string, options []string, usage string) *pflag.Flag {

Callers 9

NewCmdListFunction · 0.92
NewCmdCreateFunction · 0.92
NewCmdEditFunction · 0.92
NewCmdCommitsFunction · 0.92
NewCmdPrsFunction · 0.92
NewCmdIssuesFunction · 0.92
NewCmdReposFunction · 0.92
NewCmdEditFunction · 0.92
NewCmdListFunction · 0.92

Calls 1

newBoolValueFunction · 0.85

Tested by

no test coverage detected