Documentation
¶
Index ¶
Constants ¶
View Source
const (
// SectionAliases is the help template section that displays command aliases.
SectionUsage = `Usage: {{if .Runnable}}{{.UseLine}}{{end}}{{if .HasAvailableSubCommands}}{{.CommandPath}} [command]{{end}}
`
// SectionAliases is the help template section that displays command aliases.
SectionAliases = `{{if gt .Aliases 0}}Aliases:
{{.NameAndAliases}}
{{end}}`
// SectionExamples is the help template section that displays command examples.
SectionExamples = `{{if .HasExample}}Examples:
{{trimRight .Example}}
{{end}}`
// SectionSubcommands is the help template section that displays the command's subcommands.
SectionSubcommands = `{{if .HasAvailableSubCommands}}{{cmdGroupsString .}}
{{end}}`
// SectionFlags is the help template section that displays the command's flags.
SectionFlags = `{{ if .HasAvailableLocalFlags }}Flags:
{{.LocalFlags.FlagUsages | trimTrailingWhitespaces}}
{{end}}`
// SectionFlags is the help template section that displays the command's flags.
SectionGlobalFlags = `{{ if .HasAvailableInheritedFlags }}Global Flags:
{{.InheritedFlags.FlagUsages | trimTrailingWhitespaces}}
{{end}}`
// SectionTipsHelp is the help template section that displays the '--help' hint.
SectionTipsHelp = `{{if .HasAvailableSubCommands}}Use "{{.CommandPath}} [command] --help" for more information about a command.
{{end}}`
)
Variables ¶
This section is empty.
Functions ¶
func MainHelpTemplate ¶ added in v0.2.11
func MainHelpTemplate() string
MainHelpTemplate if the template for 'help' used by most commands.
func MainUsageTemplate ¶ added in v0.2.11
func MainUsageTemplate() string
MainUsageTemplate if the template for 'usage' used by most commands.
Types ¶
type CommandGroup ¶ added in v0.2.11
type CommandGroup struct {
Heading string
Commands []*cobra.Command
Summarized bool
}
type CommandGroups ¶ added in v0.2.11
type CommandGroups []CommandGroup
func CompileCommandGroups ¶ added in v0.2.11
func CompileCommandGroups(cmd *cobra.Command) CommandGroups
Click to show internal directories.
Click to hide internal directories.