command

package
v0.0.0-...-6aa8790 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	// SectionVars is the help template section that declares variables to be used in the template.
	SectionVars = `{{$isRootCmd := isRootCmd .}}` +
		`{{$rootCmd := rootCmd .}}` +
		`{{$visibleFlags := visibleFlags .Flags}}` +
		`{{$explicitlyExposedFlags := exposed .}}` +
		`{{$optionsCmdFor := optionsCmdFor .}}` +
		`{{$usageLine := usageLine .}}`

	// 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 = `` /* 260-byte string literal not displayed */

	// SectionUsage is the help template section that displays the command's usage.
	SectionUsage = `{{if and .Runnable (ne .UseLine "") (ne .UseLine $rootCmd)}}Usage:
  {{$usageLine}}
{{end}}`

	// SectionTipsHelp is the help template section that displays the '--help' hint.
	SectionTipsHelp = `{{if .HasSubCommands}}Use "{{$rootCmd}} <command> --help" for more information about a given command.
{{end}}`
)

Variables

This section is empty.

Functions

func FlagsUsages

func FlagsUsages(f *flag.FlagSet) string

func GenCliOverview

func GenCliOverview(cmdGroups Groups, pagesDir string) error

func GenCliPages

func GenCliPages(cmdGroups Groups, pagesDir string) error

func GenCliPartials

func GenCliPartials(cmd *cobra.Command, dir string) error

func GenCliSidebar

func GenCliSidebar(cmdGroups Groups, sidebarPath string) error

func GenMarkdownCustom

func GenMarkdownCustom(cmd *cobra.Command, w io.Writer) error

GenMarkdownCustom creates custom markdown output.

func MainHelpTemplate

func MainHelpTemplate() string

MainHelpTemplate if the template for 'help' used by most commands.

func MainUsageTemplate

func MainUsageTemplate() string

MainUsageTemplate if the template for 'usage' used by most commands.

func UsageLine

func UsageLine(c *cobra.Command) string

Types

type FlagExposer

type FlagExposer interface {
	ExposeFlags(cmd *cobra.Command, flags ...string) FlagExposer
}

func ActsAsRootCommand

func ActsAsRootCommand(cmd *cobra.Command, groups ...Group) FlagExposer

type Group

type Group struct {
	Message  string
	Commands []*cobra.Command
}

type Groups

type Groups []Group

func (Groups) Add

func (g Groups) Add(c *cobra.Command)

func (Groups) Has

func (g Groups) Has(c *cobra.Command) bool

Jump to

Keyboard shortcuts

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