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(cmd *cobra.Command, flag string) *bool
- func FlagToBoolValue(cmd *cobra.Command, flag string) bool
- func FlagToDateTimePointer(cmd *cobra.Command, flag, format string) (*time.Time, error)
- func FlagToInt64Pointer(cmd *cobra.Command, flag string) *int64
- func FlagToStringPointer(cmd *cobra.Command, flag string) *string
- func FlagToStringSlicePointer(cmd *cobra.Command, flag string) *[]string
- func FlagToStringSliceValue(cmd *cobra.Command, flag string) []string
- func FlagToStringToStringPointer(cmd *cobra.Command, flag string) *map[string]string
- func FlagToStringValue(cmd *cobra.Command, flag string) string
- func FlagWithDefaultToInt64Value(cmd *cobra.Command, flag string) int64
- func FlagWithDefaultToStringSlicePointer(cmd *cobra.Command, flag string) *[]string
- func FlagWithDefaultToStringValue(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 ¶
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 ¶
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 ¶
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.