Documentation
¶
Overview ¶
Package args contains shared utility methods for argument parsing and validation.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CIDR ¶ added in v0.3.1
type CIDR struct {
// contains filtered or unexported fields
}
CIDR implements the flag.Value interface and allows to parse strings in CIDR format lists in the form: "x.x.x.x/y".
type CIDRList ¶
type CIDRList struct {
StringList StringList
CIDRList []net.IPNet
}
CIDRList implements the flag.Value interface and allows to parse stringified lists in the form: "val1,val2".
type Percentage ¶
type Percentage struct {
Val uint64
}
Percentage implements the flag.Value interface and allows to parse stringified percentages.
func (*Percentage) Set ¶
func (p *Percentage) Set(str string) error
Set parses the provided string into the percentage.
func (Percentage) String ¶
func (p Percentage) String() string
String returns the stringified percentage.
type Quantity ¶ added in v0.3.2
Quantity implements the flag.Value interface and allows to parse strings expressing resource quantities.
func NewQuantity ¶ added in v0.3.2
NewQuantity returns a new Quantity object initialized with the given resource quantity.
type StringEnum ¶ added in v0.3.2
StringEnum is a type used to validate a string parameter is included in a set of allowed values.
func NewEnum ¶ added in v0.3.2
func NewEnum(allowed []string, d string) *StringEnum
NewEnum give a list of allowed flag parameters, where the second argument is the default.
func (*StringEnum) Set ¶ added in v0.3.2
func (a *StringEnum) Set(p string) error
Set parses the provided string checking its validity and setting it inside the Value field.
func (StringEnum) String ¶ added in v0.3.2
func (a StringEnum) String() string
String returns the stringified value.
func (*StringEnum) Type ¶ added in v0.3.2
func (a *StringEnum) Type() string
Type returns the enum type.
type StringList ¶
type StringList struct {
StringList []string
}
StringList implements the flag.Value interface and allows to parse stringified lists in the form: "val1,val2".
func (*StringList) Set ¶
func (sl *StringList) Set(str string) error
Set parses the provided string into the []string list.
func (StringList) String ¶
func (sl StringList) String() string
String returns the stringified list.