Documentation
¶
Index ¶
Constants ¶
View Source
const AppHelpTemplate = TextFormat + `{{$Green -}}
NAME:
{{$green}}{{.Name}}{{if .Usage}} - {{.Usage}}{{end}}{{$Green}}
USAGE:
{{$green}}{{if .UsageText}}{{.UsageText}}{{else}}{{.HelpName}}
{{- if .VisibleFlags}} [global options]{{end}}{{if .Commands}} command [command options]{{end}}
{{- if .ArgsUsage}} {{.ArgsUsage}}{{else}} [arguments...]{{end}}{{end}}{{$Yellow}}{{if .Version}}{{if not .HideVersion}}
VERSION:
{{$yellow}}{{.Version}}{{end}}{{end}}{{$Yellow}}{{if .Description}}
DESCRIPTION:
{{$yellow}}{{.Description}}{{end}}{{$Yellow}}{{if len .Authors}}
AUTHOR{{with $length := len .Authors}}{{if ne 1 $length}}S{{end}}{{end}}:
{{$yellow}}{{range $index, $author := .Authors}}{{if $index}}
{{end}}{{$author}}{{end}}{{end}}{{$Blue}}{{if .VisibleCommands}}
COMMANDS:{{range .VisibleCategories}}{{if .Name}}
{{.Name}}:{{range .VisibleCommands}}
{{$Blue}}{{join .Names ", "}}{{"\t\t\t\t"}}{{$blue}}{{.Usage}}{{end}}{{else}}{{range .VisibleCommands}}
{{$Blue}}{{join .Names ", "}}{{"\t\t\t\t"}}{{$blue}}{{.Usage}}{{$plain}}{{end}}{{end}}{{end}}{{end}}{{if .VisibleFlags}}{{$Cyan}}
GLOBAL OPTIONS:
{{range $index, $option := .VisibleFlags}}{{if $index}}
{{end}}{{$cyan}}{{$option}}{{$plain}}{{end}}{{end}}{{$Green}}{{if .Copyright}}
COPYRIGHT:
{{$green}}{{.Copyright}}{{end}}{{$plain}}
`
View Source
const CommandHelpTemplate = TextFormat + `{{$Green -}}
NAME:
{{$green}}{{.HelpName}}{{if .VisibleFlags}} [command options]{{end}}{{- if .ArgsUsage}} {{.ArgsUsage}}{{else}}{{end}} - {{.Usage}}{{$Green}}
USAGE:
{{$green}}{{if .UsageText}}{{.UsageText | nindent 2 | trim}}{{else}}{{.HelpName}}{{if .VisibleFlags}} [command options]{{end}}
{{- if .ArgsUsage}} {{.ArgsUsage}}{{end}}{{end}}{{$Green}}{{if .Category}}
CATEGORY:
{{$green}}{{.Category}}{{end}}{{$Blue}}{{if .Description}}
DESCRIPTION:
{{$blue}}{{.Description}}{{end}}{{$Cyan}}{{if .VisibleFlags}}
OPTIONS:
{{$cyan}}{{range .VisibleFlags}}{{.}}
{{end}}{{end}}{{$plain}}
`
View Source
const SubcommandHelpTemplate = TextFormat + `{{$Green -}}
NAME:
{{$green}}{{.HelpName}} - {{if .Description}}{{.Description}}{{else}}{{.Usage}}{{end}}{{$Green}}
USAGE:
{{$green}}{{if .UsageText}}{{.UsageText | nindent 2 | trim}}{{else}}{{.HelpName}} command{{if .VisibleFlags}} [command options]{{end}}
{{- if .ArgsUsage}} {{.ArgsUsage}}{{else}} [arguments...]{{end}}{{end}}{{$Blue}}
COMMANDS:{{range .VisibleCategories}}{{if .Name}}
{{.Name}}:{{range .VisibleCommands}}
{{$Blue}}{{join .Names ", "}}{{$blue}}{{"\t"}}{{.Usage}}{{end}}{{else}}{{range .VisibleCommands}}
{{$Blue}}{{join .Names ", "}}{{$blue}}{{"\t"}}{{.Usage}}{{end}}{{end}}{{end}}{{if .VisibleFlags}}{{$Cyan}}
OPTIONS:
{{$cyan}}{{range .VisibleFlags}}{{.}}
{{end}}{{end}}{{$plain}}
`
View Source
const TextFormat = `` /* 531-byte string literal not displayed */
TextFormat defines variables of style and colors.
Variables ¶
This section is empty.
Functions ¶
func ExpandFilePath ¶
ExpandFilePath expands the leading `~` to absolute path
func UserHomeDir ¶
func UserHomeDir() string
UserHomeDir returns the current user's home directory absolute path, which is usually represented as `~` in most shells
Types ¶
Click to show internal directories.
Click to hide internal directories.