MCPcopy
hub / github.com/urfave/cli / BoolWithInverseFlag

Struct BoolWithInverseFlag

flag_bool_with_inverse.go:12–40  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

10var DefaultInverseBoolPrefix = "no-"
11
12type BoolWithInverseFlag struct {
13 Name string `json:"name"` // name of the flag
14 Category string `json:"category"` // category of the flag, if any
15 DefaultText string `json:"defaultText"` // default text of the flag for usage purposes
16 HideDefault bool `json:"hideDefault"` // whether to hide the default value in output
17 Usage string `json:"usage"` // usage string for help output
18 Sources ValueSourceChain `json:"-"` // sources to load flag value from
19 Required bool `json:"required"` // whether the flag is required or not
20 Hidden bool `json:"hidden"` // whether to hide the flag in help output
21 Local bool `json:"local"` // whether the flag needs to be applied to subcommands as well
22 Value bool `json:"defaultValue"` // default value for this flag if not set by from any source
23 Destination *bool `json:"-"` // destination pointer for value when set
24 Aliases []string `json:"aliases"` // Aliases that are allowed for this flag
25 TakesFile bool `json:"takesFileArg"` // whether this flag takes a file argument, mainly for shell completion purposes
26 Action func(context.Context, *Command, bool) error `json:"-"` // Action callback to be called when flag is set
27 OnlyOnce bool `json:"onlyOnce"` // whether this flag can be duplicated on the command line
28 Validator func(bool) error `json:"-"` // custom function to validate this flag value
29 ValidateDefaults bool `json:"validateDefaults"` // whether to validate defaults or not
30 Config BoolConfig `json:"config"` // Additional/Custom configuration associated with this flag type
31 InversePrefix string `json:"invPrefix"` // The prefix used to indicate a negative value. Default: `env` becomes `no-env`
32
33 // unexported fields for internal use
34 count int // number of times the flag has been set
35 hasBeenSet bool // whether the flag has been set from env or file
36 applied bool // whether the flag has been applied to a flag set already
37 value Value // value representing this flag's value
38 pset bool
39 nset bool
40}
41
42func (bif *BoolWithInverseFlag) IsSet() bool {
43 return bif.hasBeenSet

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected