cobrautils

package
v0.12.0 Latest Latest
Warning

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

Go to latest
Published: Jul 19, 2024 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

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 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 Find added in v0.12.0

func Find(cmd *cobra.Command, name string) *cobra.Command
func FormatLink(pname string, linkhandler func(string) string) string

func FormatLinkWithHandler

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

func GetHelpCommand added in v0.12.0

func GetHelpCommand(cmd *cobra.Command) *cobra.Command

func LinkForCmd

func LinkForCmd(cmd *cobra.Command) string

func LinkForPath

func LinkForPath(path string) string

func SetCommandSubstitution added in v0.12.0

func SetCommandSubstitution(cmd *cobra.Command, remove int, prepend []string)

func SetCommandSubstitutionForTree added in v0.12.0

func SetCommandSubstitutionForTree(cmd *cobra.Command, remove int, prepend []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) *cobra.Command

func TweakHelpCommandFor added in v0.12.0

func TweakHelpCommandFor(c *cobra.Command) *cobra.Command

TweakHelpCommandFor generates a help command similar to the default cobra one, which forwards the additional arguments to the help function.

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.

Jump to

Keyboard shortcuts

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