group

package
v2.11.26 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 3, 2024 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddCommandGroups

func AddCommandGroups(rootCommand *cobra.Command, groups CommandGroups) *cobra.Command

AddCommandGroups adds CommandGroups to a given cobra Command. A side effact of calling this function is that subcommands will no longer be able to use their own usage or help funcs.

func CommandGroupHelpFunc

func CommandGroupHelpFunc(rootCommand *cobra.Command, groups CommandGroups, templateFuncs *template.FuncMap) func(*cobra.Command, []string)

CommandGroupHelpFunc returns a HelpFunc a root level command can use.

func CommandGroupUsageFunc

func CommandGroupUsageFunc(groups CommandGroups, templateFuncs *template.FuncMap) func(*cobra.Command) error

CommandGroupUsageFunc returns a UsageFunc a root level command can use.

func PrintTemplate

func PrintTemplate(out io.Writer, text string, data interface{}, templateFuncs *template.FuncMap) error

PrintTemplate prints the provided template to the output writer.

func PrintTrimmedMultilineString

func PrintTrimmedMultilineString(str string, out io.Writer)

PrintTrimmedMultilineString does just that.

Types

type CommandGroup

type CommandGroup struct {
	Name     string
	Commands []*cobra.Command
}

CommandGroup is a logical grouping of commands

type CommandGroups

type CommandGroups []CommandGroup

CommandGroups is a list of CommandGroups.

func (CommandGroups) CalculateMinWidth

func (groups CommandGroups) CalculateMinWidth() int

CalculateMinWidth gets the minimum width required for all command names.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL