Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetOptionalBoolFlag ¶
GetOptionalBoolFlag returns the value of the specified flag from a cobra command, or the zero value (false) if the flag was not specified.
func GetOptionalStringArrayFlag ¶
GetOptionalStringArrayFlag returns the value of the specified flag from a cobra command, or the zero value if the flag was not specified.
Types ¶
type Enum ¶
type Enum struct {
// contains filtered or unexported fields
}
Enum is a Cobra-compatible wrapper for defining a string flag that can be one of a specified set of values.
func NewEnum ¶
NewEnum returns a new enum flag with the specified list of allowed values, and the specified default value if none is set.
func (*Enum) AllowedValues ¶
AllowedValues returns a slice of the flag's valid values.
func (*Enum) Set ¶
Set assigns the provided string to the enum receiver. It returns an error if the string is not an allowed value.
type LabelSelector ¶
type LabelSelector struct {
LabelSelector *metav1.LabelSelector
}
LabelSelector is a Cobra-compatible wrapper for defining a Kubernetes label-selector flag.
func (*LabelSelector) Set ¶
func (ls *LabelSelector) Set(s string) error
Set parses the provided string and assigns the result to the label-selector receiver. It returns an error if the string is not parseable.
func (*LabelSelector) String ¶
func (ls *LabelSelector) String() string
String returns a string representation of the label selector flag.
func (*LabelSelector) Type ¶
func (ls *LabelSelector) Type() string
Type returns a string representation of the LabelSelector type.
type Map ¶
type Map struct {
// contains filtered or unexported fields
}
Map is a Cobra-compatible wrapper for defining a flag containing map data (i.e. a collection of key-value pairs).
func NewMap ¶
func NewMap() Map
NewMap returns a Map using the default delimiters ("=" between keys and values, and "," between map entries, e.g. k1=v1,k2=v2)
func (*Map) Set ¶
Set parses the provided string according to the delimiters and assigns the result to the Map receiver. It returns an error if the string is not parseable.
func (Map) WithEntryDelimiter ¶
WithEntryDelimiter sets the delimiter to be used between map entries.
For example, in "k1=v1&k2=v2", the entry delimiter is "&"
func (Map) WithKeyValueDelimiter ¶
WithKeyValueDelimiter sets the delimiter to be used between keys and values.
For example, in "k1=v1&k2=v2", the key-value delimiter is "="
type OptionalBool ¶
type OptionalBool struct {
Value *bool
}
func NewOptionalBool ¶
func NewOptionalBool(defaultValue *bool) OptionalBool
func (*OptionalBool) Set ¶
func (f *OptionalBool) Set(val string) error
func (*OptionalBool) String ¶
func (f *OptionalBool) String() string
String returns a string representation of the enum flag.
func (*OptionalBool) Type ¶
func (f *OptionalBool) Type() string
type StringArray ¶
type StringArray []string
StringArray is a Cobra-compatible named type for defining a string slice flag.
func NewStringArray ¶
func NewStringArray(initial ...string) StringArray
NewStringArray returns a StringArray for a provided slice of values.
func (*StringArray) Set ¶
func (sa *StringArray) Set(s string) error
Set comma-splits the provided string and assigns the results to the receiver. It returns an error if the string is not parseable.
func (*StringArray) String ¶
func (sa *StringArray) String() string
String returns a comma-separated list of the items in the string array.
func (*StringArray) Type ¶
func (sa *StringArray) Type() string
Type returns a string representation of the StringArray type.