Documentation ¶
Index ¶
- Constants
- func AddGroup(cmd *cobra.Command, id string, title string, groupCmds ...*cobra.Command)
- func Age(t, currentTime time.Time) string
- func ChainRunE(fns ...func(cmd *cobra.Command, args []string) error) func(cmd *cobra.Command, args []string) error
- func Datetime(t time.Time) string
- func DescribeFormat(out io.Writer, object interface{}, format string) error
- func DescribeJSON(out io.Writer, object interface{}) error
- func DescribeYAML(out io.Writer, object interface{}) error
- func ExactlyOneSet(s string, ss ...string) bool
- func LabelsToString(labels map[string]string) string
- func ListLongDescription(intro string, columns []string) string
- func NA(s string) string
- func PrefixLines(text, prefix string) string
- func SplitLabel(label string) []string
- func SplitLabelVars(label string) (string, string)
- func ValidateRequiredFlags(flags *pflag.FlagSet, names ...string) error
- func Wrap(key string, value any) map[string]any
- func YesNo(b bool) string
Constants ¶
const ( Byte = 1 Kibibyte = Byte * 1024 Mebibyte = Kibibyte * 1024 Gibibyte = Mebibyte * 1024 Tebibyte = Gibibyte * 1024 )
Variables ¶
This section is empty.
Functions ¶
func AddGroup ¶
AddGroup adds a group to the passed command and adds the passed commands to the group.
func DescribeJSON ¶
func DescribeYAML ¶
func ExactlyOneSet ¶
func LabelsToString ¶
func ListLongDescription ¶
func PrefixLines ¶
PrefixLines will prefix all individual lines in the text with the passed prefix.
func SplitLabel ¶
func SplitLabelVars ¶
SplitLabelVars splits up label into key and value and returns them as separate return values. If label doesn't contain the `=` separator, SplitLabelVars returns the original string as key, with an empty value.
func ValidateRequiredFlags ¶
ValidateRequiredFlags ensures that flags has values for all flags with the passed names.
This function duplicates the functionality cobra provides when calling MarkFlagRequired. However, in some cases a flag cannot be marked as required in cobra, for example when it depends on other flags. In those cases this function comes in handy.
Types ¶
This section is empty.