Documentation ¶
Index ¶
- Constants
- func CleanMarkdown(s string) string
- func CleanMarkdownUsageFunc(cmd *cobra.Command)
- func FormatLink(pname string, linkhandler func(string) string) string
- func FormatLinkWithHandler(linkhandler func(string) string) func(string) string
- func LinkForCmd(cmd *cobra.Command) string
- func LinkForPath(path string) string
- func SubstituteCommandLinks(desc string, linkformat func(string) string) ([]string, string)
- func SupportNestedHelpFunc(cmd *cobra.Command)
- func TweakCommand(cmd *cobra.Command, ctx out.Context)
Constants ¶
View Source
const HelpTemplate = "{{.CommandPath}} \u2014 {{title .Short}}" + `{{if .IsAvailableCommand}}
Synopsis:{{if .Runnable}}
{{.UseLine}}{{end}}{{if .HasAvailableSubCommands}}
{{if or .Runnable (soleCommand .Use)}}{{if .HasAvailableLocalFlags}}{{.CommandPath}} [<options>] <sub-command> ...{{else}}{{.CommandPath}} <sub-command> ...{{end}}{{else}}{{.UseLine}}{{end}}{{end}}{{if gt (len .Aliases) 0}}
Aliases:
{{.NameAndAliases}}{{end}}{{end}}{{if .HasAvailableSubCommands}}
Available Commands:{{range .Commands}}{{if (or .IsAvailableCommand (eq .Name "help"))}}
{{rpad .Name .NamePadding }} {{.Short}}{{end}}{{end}}{{end}}{{if and .HasAvailableLocalFlags .IsAvailableCommand}}
Flags:
{{ flagUsages .LocalFlags | trimTrailingWhitespaces}}{{end}}{{if and .HasAvailableInheritedFlags .IsAvailableCommand}}
Global Flags:
{{.InheritedFlags.FlagUsages | trimTrailingWhitespaces}}{{end}}
Description:
{{with (or .Long .Short)}}{{. | substituteCommandLinks | trimTrailingWhitespaces | indent 2}}{{end}}{{if .HasAvailableSubCommands}}
Use {{.CommandPath}} <command> -h for additional help.
{{end}}{{if .HasExample}}
Examples:
{{.Example | indent 2}}{{end}}{{if .HasHelpSubCommands}}
Additional help topics:{{range .Commands}}{{if .IsAdditionalHelpTopicCommand}}
{{rpad .CommandPath .CommandPathPadding}} {{.Short}}{{end}}{{end}}{{end}}{{if .HasAvailableSubCommands}}
{{end}}
`
View Source
const UsageTemplate = `` /* 1022-byte string literal not displayed */
Variables ¶
This section is empty.
Functions ¶
func CleanMarkdown ¶
func CleanMarkdownUsageFunc ¶
CleanMarkdownUsageFunc removes markdown tags from the long usage of the command. With this func it is possible to generate the markdown docs but still have readable commandline help func.
func FormatLinkWithHandler ¶
func LinkForCmd ¶
func LinkForPath ¶
func SubstituteCommandLinks ¶
func SupportNestedHelpFunc ¶
SupportNestedHelpFunc adds support help evaluation of given nested command path.
Types ¶
This section is empty.
Directories ¶
Path | Synopsis |
---|---|
flagsetscheme
Package flagsetscheme provides a runtime.TypeScheme with support for command line option sets for the described object types.
|
Package flagsetscheme provides a runtime.TypeScheme with support for command line option sets for the described object types. |
Click to show internal directories.
Click to hide internal directories.