cmd

package
v0.2.14 Latest Latest
Warning

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

Go to latest
Published: Nov 22, 2020 License: MPL-2.0 Imports: 18 Imported by: 0

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.

func ParseArgs added in v0.2.11

func ParseArgs(ctx context.Context, args []string, opts *cmdutil.Options) error

ParseArgs parses CLI args and executes the select command

func RootCmd added in v0.2.11

func RootCmd(opts *cmdutil.Options) *cobra.Command

Types

type CommandGroup added in v0.2.11

type CommandGroup struct {
	Heading    string
	Commands   []*cobra.Command
	Summarized bool
}

func (*CommandGroup) Names added in v0.2.11

func (g *CommandGroup) Names() (names []string)

func (*CommandGroup) String added in v0.2.11

func (g *CommandGroup) String() (s string)

type CommandGroups added in v0.2.11

type CommandGroups []CommandGroup

func CompileCommandGroups added in v0.2.11

func CompileCommandGroups(cmd *cobra.Command) CommandGroups

func (CommandGroups) String added in v0.2.11

func (grps CommandGroups) String() string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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