Documentation ¶
Index ¶
- type CobraStringSliceValue
- func (c *CobraStringSliceValue) AllowedString() string
- func (c *CobraStringSliceValue) GetSlice() []string
- func (c *CobraStringSliceValue) IsSet() bool
- func (c *CobraStringSliceValue) Set(values string) error
- func (c *CobraStringSliceValue) String() string
- func (c *CobraStringSliceValue) Type() string
- type CobraStringValue
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CobraStringSliceValue ¶
type CobraStringSliceValue struct {
// contains filtered or unexported fields
}
CobraStringSliceValue is similar to spf13.pflag.stringSliceValue but enforces allowed values
func MakeCobraStringSliceValue ¶
func MakeCobraStringSliceValue(value *[]string, others []string) *CobraStringSliceValue
MakeCobraStringSliceValue creates a string slice value (satisfying spf13/pflag.Value interface) for a limited number of valid options
func (*CobraStringSliceValue) AllowedString ¶
func (c *CobraStringSliceValue) AllowedString() string
AllowedString returns a comma-separated string of allowed values
func (*CobraStringSliceValue) GetSlice ¶
func (c *CobraStringSliceValue) GetSlice() []string
GetSlice returns a current value as a string slice
func (*CobraStringSliceValue) IsSet ¶
func (c *CobraStringSliceValue) IsSet() bool
IsSet returns a boolean flag indicating of the value was changed from defaults
func (*CobraStringSliceValue) Set ¶
func (c *CobraStringSliceValue) Set(values string) error
Set sets a value and fails if it is not allowed
func (*CobraStringSliceValue) String ¶
func (c *CobraStringSliceValue) String() string
func (*CobraStringSliceValue) Type ¶
func (c *CobraStringSliceValue) Type() string
Type returns the value type as a string
type CobraStringValue ¶
type CobraStringValue struct {
// contains filtered or unexported fields
}
CobraStringValue is similar to spf13.pflag.stringValue but enforces allowed values
func MakeCobraStringValue ¶
func MakeCobraStringValue(value string, others []string) *CobraStringValue
MakeCobraStringValue creates a string value (satisfying spf13/pflag.Value interface) for a limited number of valid options
func (*CobraStringValue) AllowedString ¶
func (c *CobraStringValue) AllowedString() string
AllowedString returns a comma-separated string of allowed values
func (*CobraStringValue) IsSet ¶
func (c *CobraStringValue) IsSet() bool
IsSet returns a boolean flag indicating of the value was changed from defaults
func (*CobraStringValue) Set ¶
func (c *CobraStringValue) Set(other string) error
Set sets a value and fails if it is not allowed
func (*CobraStringValue) String ¶
func (c *CobraStringValue) String() string
func (*CobraStringValue) Type ¶
func (c *CobraStringValue) Type() string
Type returns the value type as a string