Documentation ¶
Overview ¶
Package flags provides helper methods for working with Cobra flags in a way where Go's usage checker (which produces compilation errors for unused variables) enforces that the programmer didn't forget to define or read the flag.
Index ¶
- func Bool(name, short, desc string, persistent FlagType) (AddFunc, ReadBoolFlagFunc)
- func DryRun() (AddFunc, ReadBoolFlagFunc)
- func String(name, short, defaultValue, desc string) (AddFunc, ReadStringFlagFunc)
- func Verbose() (AddFunc, ReadBoolFlagFunc)
- func Version() (AddFunc, ReadBoolFlagFunc)
- type AddFunc
- type FlagType
- type ReadBoolFlagFunc
- type ReadStringFlagFunc
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Bool ¶
func Bool(name, short, desc string, persistent FlagType) (AddFunc, ReadBoolFlagFunc)
Bool provides mistake-safe access to boolean Cobra command-line flags.
func DryRun ¶
func DryRun() (AddFunc, ReadBoolFlagFunc)
DryRun provides mistake-safe access to the "--dry-run" Cobra command-line flag.
func String ¶
func String(name, short, defaultValue, desc string) (AddFunc, ReadStringFlagFunc)
Bool provides mistake-safe access to string Cobra command-line flags.
func Verbose ¶
func Verbose() (AddFunc, ReadBoolFlagFunc)
Verbose provides mistake-safe access to the "--verbose" Cobra command-line flag.
func Version ¶
func Version() (AddFunc, ReadBoolFlagFunc)
Types ¶
type AddFunc ¶
AddFunc defines the type signature for helper functions that add a CLI flag to a Cobra command.
type ReadBoolFlagFunc ¶
ReadBoolFlagFunc defines the type signature for helper functions that provide the value a boolean CLI flag associated with a Cobra command.
type ReadStringFlagFunc ¶
ReadStringFlagFunc defines the type signature for helper functions that provide the value a string CLI flag associated with a Cobra command.