Documentation ¶
Index ¶
- func GetOptionalBoolFlag(cmd *cobra.Command, flagName string) bool
- func GetOptionalStringArrayFlag(cmd *cobra.Command, flagName string) []string
- func GetOptionalStringFlag(cmd *cobra.Command, flagName string) string
- type Enum
- type LabelSelector
- type Map
- type OptionalBool
- type OrLabelSelector
- type StringArray
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 ¶ added in v0.4.0
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 ¶ added in v0.4.0
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 ¶ added in v0.9.0
AllowedValues returns a slice of the flag's valid values.
func (*Enum) Set ¶ added in v0.4.0
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 ¶ added in v0.4.0
type OptionalBool struct {
Value *bool
}
func NewOptionalBool ¶ added in v0.4.0
func NewOptionalBool(defaultValue *bool) OptionalBool
func (*OptionalBool) Set ¶ added in v0.4.0
func (f *OptionalBool) Set(val string) error
func (*OptionalBool) String ¶ added in v0.4.0
func (f *OptionalBool) String() string
String returns a string representation of the enum flag.
func (*OptionalBool) Type ¶ added in v0.4.0
func (f *OptionalBool) Type() string
type OrLabelSelector ¶ added in v1.12.1
type OrLabelSelector struct {
OrLabelSelectors []*metav1.LabelSelector
}
OrLabelSelector is a Cobra-compatible wrapper for defining a Kubernetes or-label-selector flag.
func (*OrLabelSelector) Set ¶ added in v1.12.1
func (ls *OrLabelSelector) Set(s string) error
Set parses the provided string and assigns the result to the or-label-selector receiver. It returns an error if the string is not parseable.
func (*OrLabelSelector) String ¶ added in v1.12.1
func (ls *OrLabelSelector) String() string
String returns a string representation of the or-label selector flag.
func (*OrLabelSelector) Type ¶ added in v1.12.1
func (ls *OrLabelSelector) Type() string
Type returns a string representation of the OrLabelSelector type.
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.