cobrautils

package
v0.0.0-...-877fc11 Latest Latest
Warning

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

Go to latest
Published: Jun 7, 2024 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

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 CleanMarkdown(s string) string

func CleanMarkdownUsageFunc

func CleanMarkdownUsageFunc(cmd *cobra.Command)

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 FormatLink(pname string, linkhandler func(string) string) string

func FormatLinkWithHandler

func FormatLinkWithHandler(linkhandler func(string) string) func(string) string

func LinkForCmd

func LinkForCmd(cmd *cobra.Command) string

func LinkForPath

func LinkForPath(path string) string
func SubstituteCommandLinks(desc string, linkformat func(string) string) ([]string, string)

func SupportNestedHelpFunc

func SupportNestedHelpFunc(cmd *cobra.Command)

SupportNestedHelpFunc adds support help evaluation of given nested command path.

func TweakCommand

func TweakCommand(cmd *cobra.Command, ctx out.Context)

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.

Jump to

Keyboard shortcuts

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