package flag
import "github.com/coreos/rkt/pkg/flag"
Index ¶
- func SerializePairs(pairs map[string]string) string
- type BitFlags
- func NewBitFlags(permissibleOptions []string, defaultOptions string, flagMap map[string]int) (*BitFlags, error)
- func (bf *BitFlags) HasFlag(f int) bool
- func (bf *BitFlags) Set(s string) error
- type DiscardFlag
- func NewDiscardFlag(name string) *DiscardFlag
- func (df *DiscardFlag) Set(_ string) error
- func (df *DiscardFlag) String() string
- func (df *DiscardFlag) Type() string
- type OptionList
- func NewOptionList(permissibleOptions []string, defaultOptions string) (*OptionList, error)
- func (ol *OptionList) PermissibleString() string
- func (ol *OptionList) Set(s string) error
- func (ol *OptionList) String() string
- func (ol *OptionList) Type() string
- type PairList
- func MustNewPairList(permissiblePairs map[string][]string, defaults map[string]string) *PairList
- func NewPairList(permissiblePairs map[string][]string, defaults map[string]string) (*PairList, error)
- func (pl *PairList) Keys() []string
- func (pl *PairList) PermissibleString() string
- func (pl *PairList) Set(s string) error
- func (pl *PairList) SetOne(key, val string) error
- func (pl *PairList) String() string
- func (pl *PairList) Type() string
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
func NewBitFlags ¶
func NewBitFlags(permissibleOptions []string, defaultOptions string, flagMap map[string]int) (*BitFlags, error)
NewBitFlags initializes a simple bitflag version of the OptionList Type. flagMap is the mapping from option names to the integer value
func (*BitFlags) HasFlag ¶
func (*BitFlags) Set ¶
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) Keys ¶
Keys returns a sorted list of all present keys
func (*PairList) PermissibleString ¶
PermissibleString generates a posix-cli-doc style string. For example, a=[b|c|d] w=[x|y|z] l=*
func (*PairList) Set ¶
Set parses a "k=v[,kk=vv...]" string
func (*PairList) SetOne ¶
SetOne validates and sets an individual key-value pair It will overwrite an existing value
func (*PairList) String ¶
String presents a k=v list in key=sorted order
func (*PairList) Type ¶
Source Files ¶
bitflags.go discard.go optionlist.go pairlist.go
- Version
- v1.30.0 (latest)
- Published
- Apr 13, 2018
- Platform
- linux/amd64
- Imports
- 5 packages
- Last checked
- 2 days ago –
Tools for package owners.