Documentation ¶
Index ¶
Constants ¶
const ( FlagToggle = iota FlagOption )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Flags ¶
type Flags struct {
// contains filtered or unexported fields
}
func ParseArgvKeyValue ¶
ParseArgvKeyValue parses a clean (trimmed) argv whose components are either toggles or key=value pairs. IOW, this is a restricted and easier to parse flavor of argv on which option and value are guaranteed to be in the same item. IOW, we expect "--opt=foo" AND NOT "--opt", "foo"
func ParseArgvKeyValueWithCommand ¶
ParseArgvKeyValueWithCommand parses a clean (trimmed) argv whose components are either toggles or key=value pairs. IOW, this is a restricted and easier to parse flavor of argv on which option and value are guaranteed to be in the same item. IOW, we expect "--opt=foo" AND NOT "--opt", "foo" The command is supplied explicitly as parameter. DEPRECATED: use ParseArgvValue and WithCommand option
func WithFlagNormalization ¶ added in v0.18.2
WithFlagNormalization optionally enables flag normalization. The canonical representation of flags in this package is: * single-dash for one-char flags (-v, -h) * double-dash for multi-char flags (--foo, --long-option) pflag allows one-char to have one or two dashes. For flagcodec these were different options. When normalization is enabled, though, all flag names are processed to adhere to the canonical representation, so flagcodec will treat `--v` and `-v` to be the same flag. Since this is possibly breaking change, this treatment is opt-in.