Documentation
¶
Index ¶
Constants ¶
const Logo = `` /* 215-byte string literal not displayed */
Logo is the ASCII art logo displayed in help output.
Variables ¶
var ( Version = "dev" BuildTime = "unknown" )
Version info set by the commands package at init time.
var HelpTemplate = `
{{if or .Runnable .HasSubCommands}}{{.UsageString}}{{end}}`
var UsageTemplate = Logo + `{{versionInfo}}
Usage:{{if .Runnable}}
{{.UseLine}}{{end}}{{if .HasAvailableSubCommands}}
{{.CommandPath}} [command]{{end}}{{if gt (len .Aliases) 0}}
Aliases:
{{.NameAndAliases}}{{end}}{{if .HasExample}}
Examples:
{{.Example}}{{end}}{{if .HasAvailableSubCommands}}
Available Commands:{{range .Commands}}{{if (or .IsAvailableCommand (eq .Name "help"))}}
{{rpad .Name .NamePadding }} {{.Short}}{{end}}{{end}}{{end}}{{if .HasAvailableLocalFlags}}
Flags:
{{wrappedFlagUsages .LocalFlags | trimTrailingWhitespaces}}{{end}}{{if .HasAvailableInheritedFlags}}
Global Flags:
{{wrappedFlagUsages .InheritedFlags | trimTrailingWhitespaces}}{{end}}{{if .HasHelpSubCommands}}
Additional help topics:{{range .Commands}}{{if .IsAdditionalHelpTopicCommand}}
{{rpad .CommandPath .CommandPathPadding}} {{.Short}}{{end}}{{end}}{{end}}{{if .HasAvailableSubCommands}}
Use "{{.CommandPath}} [command] --help" for more information about a command.{{end}}
`
UsageTemplate is identical to the default cobra usage template, but utilises WrappedFlagUsages to ensure flag usages don't wrap around. The logo and version info are prepended to the usage output.
Functions ¶
func SetupLogger ¶
SetupLogger creates a zap logger instance that writes to a file. Due to the CLI heavily using bubbletea to provide interactive experiences, we log to a file by default.
func VersionInfo ¶ added in v0.2.0
func VersionInfo() string
VersionInfo returns a formatted string with version information.
func WrappedFlagUsages ¶
WrappedFlagUsages wraps long descriptions for flags, this uses the users terminal size or width of 80 if cannot determine users width.
Types ¶
This section is empty.