Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func SerializePairs ¶
Serialize takes a map and generates a string that can be parsed by Set
Types ¶
type BitFlags ¶
type BitFlags struct { *OptionList Flags int FlagMap map[string]int }
BitFlags is a flag value type supporting a csv list of options stored as bits
type DiscardFlag ¶
type DiscardFlag struct { Name string // contains filtered or unexported fields }
DiscardFlag is a flag type that discards all options with a warning
func NewDiscardFlag ¶
func NewDiscardFlag(name string) *DiscardFlag
func (*DiscardFlag) Set ¶
func (df *DiscardFlag) Set(_ string) error
func (*DiscardFlag) String ¶
func (df *DiscardFlag) String() string
func (*DiscardFlag) Type ¶
func (df *DiscardFlag) Type() string
type OptionList ¶
type OptionList struct { // Options field holds all specified and valid options. Should // not be modified. Options []string // contains filtered or unexported fields }
OptionList is a flag value type supporting a csv list of options
func NewOptionList ¶
func NewOptionList(permissibleOptions []string, defaultOptions string) (*OptionList, error)
NewOptionList initializes an OptionList. PermissibleOptions is the complete set of allowable options. It will set all options specified in defaultOptions as provided; they will all be cleared if this flag is passed in the CLI
func (*OptionList) PermissibleString ¶
func (ol *OptionList) PermissibleString() string
func (*OptionList) Set ¶
func (ol *OptionList) Set(s string) error
func (*OptionList) String ¶
func (ol *OptionList) String() string
func (*OptionList) Type ¶
func (ol *OptionList) Type() string
type PairList ¶
PairList is a flag value supporting a list of key=value pairs It will optionally validate the supplied keys and / or values It would parse something like "--arg foo=bar --arg baz=bar"
func MustNewPairList ¶
MustNewPairList is the same as NewPairList, but panics instead of returning error So check that your defaults are correct :-)
func NewPairList ¶
func NewPairList(permissiblePairs map[string][]string, defaults map[string]string) (*PairList, error)
NewPairList initializes a new pair list If permissiblePairs is not empty, then it will validate keys and values. For every key in permissiblePairs, if the value is an empty list, then any value is allowed. If there is a list, then only those values are allowed for that. for example, { "a": {"1", "two", "cheese"}, "b" : {}} would accept a=1 and any b, but no other keys defaults is a list of default parameters
func (*PairList) PermissibleString ¶
PermissibleString generates a posix-cli-doc style string. For example, a=[b|c|d] w=[x|y|z] l=*
func (*PairList) SetOne ¶
SetOne validates and sets an individual key-value pair It will overwrite an existing value