Documentation ¶
Index ¶
- func CIDRFlag() *cidrFlag
- func CIDRSliceFlag() *cidrSliceFlag
- func EnumFlag(ignoreCase bool, defaultValue string, options ...string) *enumFlag
- func EnumSliceFlag(ignoreCase bool, defaultValues []string, options ...string) *enumSliceFlag
- func FlagToBoolPointer(p *print.Printer, cmd *cobra.Command, flag string) *bool
- func FlagToBoolValue(p *print.Printer, cmd *cobra.Command, flag string) bool
- func FlagToDateTimePointer(p *print.Printer, cmd *cobra.Command, flag, format string) (*time.Time, error)
- func FlagToInt64Pointer(p *print.Printer, cmd *cobra.Command, flag string) *int64
- func FlagToStringPointer(p *print.Printer, cmd *cobra.Command, flag string) *string
- func FlagToStringSlicePointer(p *print.Printer, cmd *cobra.Command, flag string) *[]string
- func FlagToStringSliceValue(p *print.Printer, cmd *cobra.Command, flag string) []string
- func FlagToStringToStringPointer(p *print.Printer, cmd *cobra.Command, flag string) *map[string]string
- func FlagToStringValue(p *print.Printer, cmd *cobra.Command, flag string) string
- func FlagWithDefaultToInt64Value(p *print.Printer, cmd *cobra.Command, flag string) int64
- func FlagWithDefaultToStringSlicePointer(p *print.Printer, cmd *cobra.Command, flag string) *[]string
- func FlagWithDefaultToStringValue(p *print.Printer, cmd *cobra.Command, flag string) string
- func MarkFlagsRequired(cmd *cobra.Command, flags ...string) error
- func ReadFromFileFlag() *readFromFileFlag
- func UUIDFlag() *uuidFlag
- func UUIDSliceFlag() *uuidSliceFlag
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CIDRSliceFlag ¶
func CIDRSliceFlag() *cidrSliceFlag
CIDRSliceFlag returns a flag which must be a valid CIDR slice.
func EnumFlag ¶
EnumFlag returns a flag which must be one of the given values. If ignoreCase is true, flag value is returned in lower case.
func EnumSliceFlag ¶
EnumSliceFlag returns a flag which is a slice which values must be one of the given values. If ignoreCase is true, values are returned in lower case.
func FlagToBoolPointer ¶
Returns a pointer to the flag's value. Returns nil if the flag is not set, if its value can not be converted to bool, or if the flag does not exist.
func FlagToBoolValue ¶
Returns the flag's value as a bool. Returns false if its value can not be converted to bool, or if the flag does not exist.
func FlagToDateTimePointer ¶
func FlagToDateTimePointer(p *print.Printer, cmd *cobra.Command, flag, format string) (*time.Time, error)
Returns a pointer to the flag's value. Returns nil if the flag is not set, or if the flag does not exist. Returns an error if its value can not be converted to a date time with the provided format.
func FlagToInt64Pointer ¶
Returns a pointer to the flag's value. Returns nil if the flag is not set, if its value can not be converted to int64, or if the flag does not exist.
func FlagToStringPointer ¶
Returns a pointer to the flag's value. Returns nil if the flag is not set, if its value can not be converted to string, or if the flag does not exist.
func FlagToStringSlicePointer ¶
Returns a pointer to the flag's value. Returns nil if the flag is not set, if its value can not be converted to []string, or if the flag does not exist.
func FlagToStringSliceValue ¶
Returns the flag's value as a []string. Returns nil if the flag is not set, if its value can not be converted to []string, or if the flag does not exist.
func FlagToStringToStringPointer ¶
func FlagToStringToStringPointer(p *print.Printer, cmd *cobra.Command, flag string) *map[string]string
Returns a pointer to the flag's value. Returns nil if the flag is not set, if its value can not be converted to map[string]string, or if the flag does not exist.
func FlagToStringValue ¶
Returns the flag's value as a string. Returns "" if the flag is not set, if its value can not be converted to string, or if the flag does not exist.
func FlagWithDefaultToInt64Value ¶
Returns the int64 value set on the flag. If no value is set, returns the flag's default value. Returns 0 if the flag value can not be converted to int64 or if the flag does not exist.
func FlagWithDefaultToStringSlicePointer ¶
func FlagWithDefaultToStringSlicePointer(p *print.Printer, cmd *cobra.Command, flag string) *[]string
Returns a pointer to the flag's value. If no value is set, returns the flag's default value. Returns nil if the flag value can't be converted to []string or if the flag does not exist.
func FlagWithDefaultToStringValue ¶
Returns the string value set on the flag. If no value is set, returns the flag's default value. Returns nil if the flag value can not be converted to string or if the flag does not exist.
func MarkFlagsRequired ¶
Marks all given flags as required, causing the command to report an error if invoked without them.
func ReadFromFileFlag ¶
func ReadFromFileFlag() *readFromFileFlag
ReadFromFileFlag returns a string flag. If it starts with "@", it is assumed to be a file path and content is read from file instead
func UUIDSliceFlag ¶
func UUIDSliceFlag() *uuidSliceFlag
UUIDSliceFlag returns a flag which must be a valid slice.
Types ¶
This section is empty.