Documentation ¶
Index ¶
- Constants
- func CleanMarkdown(s string) string
- func CleanMarkdownUsageFunc(cmd *cobra.Command)
- func Find(cmd *cobra.Command, name string) *cobra.Command
- func FormatLink(pname string, linkhandler func(string) string) string
- func FormatLinkWithHandler(linkhandler func(string) string) func(string) string
- func GetHelpCommand(cmd *cobra.Command) *cobra.Command
- func LinkForCmd(cmd *cobra.Command) string
- func LinkForPath(path string) string
- func SetCommandSubstitution(cmd *cobra.Command, remove int, prepend []string)
- func SetCommandSubstitutionForTree(cmd *cobra.Command, remove int, prepend []string)
- func SubstituteCommandLinks(desc string, linkformat func(string) string) ([]string, string)
- func SupportNestedHelpFunc(cmd *cobra.Command)
- func TweakCommand(cmd *cobra.Command, ctx out.Context) *cobra.Command
- func TweakHelpCommandFor(c *cobra.Command) *cobra.Command
Constants ¶
View Source
const COMMAND_PATH_SUBSTITUTION = "ocm.software/commandPathSubstitution"
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 = `` /* 1029-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 SetCommandSubstitution ¶ added in v0.12.0
func SetCommandSubstitutionForTree ¶ added in v0.12.0
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. |
Package logopts is used for CLI options used to control the logging, globally or for a dedicated context.
|
Package logopts is used for CLI options used to control the logging, globally or for a dedicated context. |
Click to show internal directories.
Click to hide internal directories.