Documentation
¶
Index ¶
- Constants
- Variables
- func AddSubset(super *pflag.FlagSet, prefix string, subsetFn func(*flag.FlagSet))
- func LabelSelector(fs *flag.FlagSet, name string, defaultValue labels.Selector, usage string) *labels.Selector
- func LabelSelectorEverything(fs *flag.FlagSet, name string, usage string) *labels.Selector
- func LabelSelectorNothing(fs *flag.FlagSet, name string, usage string) *labels.Selector
- func Map[K comparable, V any](fs *flag.FlagSet, name string, defaultValue map[K]V, usage string, ...) *map[K]V
- func StringSet(fs *flag.FlagSet, name string, defaultValue []string, usage string) sets.Set[string]
- func StringSlice(fs *flag.FlagSet, name string, defaultValue []string, usage string) *[]string
- type DefaultEnumValue
- type EnumValue
- func (enum *EnumValue[T]) Default(key string) *DefaultEnumValue[T]
- func (enum *EnumValue[T]) Flag(fs *flag.FlagSet, name string, usage string) *optional.Optional[T]
- func (enum *EnumValue[T]) Set(input string) error
- func (enum *EnumValue[T]) String() string
- func (enum *EnumValue[T]) Type() string
- func (enum *EnumValue[T]) TypeName(typeName string) *EnumValue[T]
- func (enum *EnumValue[T]) With(key string, value T) *EnumValue[T]
- type Parser
Constants ¶
const EmptyFlagName string = "zzz-empty-flag-name"
Special string used to construct a flag in a subset that expect to be equal to the parent set name.
Variables ¶
var ( Int8 = makeSignedIntegerFunc[int8](8) Int16 = makeSignedIntegerFunc[int16](16) Int32 = makeSignedIntegerFunc[int32](32) Int64 = makeSignedIntegerFunc[int32](64) Uint8 = makeUnsignedIntegerFunc[uint8](8) Uint16 = makeUnsignedIntegerFunc[uint16](16) Uint32 = makeUnsignedIntegerFunc[uint32](32) Uint64 = makeUnsignedIntegerFunc[uint32](64) )
Registers a flag that parses into an integer with fixed bit size.
var ErrNoEqual = errors.TagErrorf("ErrNoEqual", "map options expect values in the form k1=v1,k2=v2,k3=v3")
Functions ¶
func LabelSelector ¶
func LabelSelector( fs *flag.FlagSet, name string, defaultValue labels.Selector, usage string, ) *labels.Selector
Registers a flag that parses into a LabelSelector using the labels.Parse syntax.
func LabelSelectorEverything ¶
Registers a flag that parses into a LabelSelector using the labels.Parse syntax and resolves into labels.Everything if unspecified.
func LabelSelectorNothing ¶
Registers a flag that parses into a LabelSelector using the labels.Parse syntax and resolves into labels.Nothing if unspecified.
func Map ¶
func Map[K comparable, V any]( fs *flag.FlagSet, name string, defaultValue map[K]V, usage string, keyParser Parser[K], valueParser Parser[V], ) *map[K]V
Registers a flag that accepts a comma-separated list of equal-delimited map entries. If the same key is specified multiple times, the last occurrence wins.
Types ¶
type DefaultEnumValue ¶
Similar to EnumValue, but with a defined default.
type EnumValue ¶
type EnumValue[T any] struct { // contains filtered or unexported fields }
A type of flag that must resolve to one of the known values of type T.
func EnumFromMap ¶
Constructs a flag that must resolve to one of the values in the map.
func (*EnumValue[T]) Default ¶
func (enum *EnumValue[T]) Default(key string) *DefaultEnumValue[T]
Assigns a default value for this flag.