Use responsive writer in help

This commit is contained in:
Fabiano Franz
2016-10-10 15:39:16 -03:00
parent f6d1ac72a0
commit 4d641c4911
4 changed files with 211 additions and 181 deletions

View File

@@ -195,33 +195,6 @@ __custom_func() {
* serviceaccounts (aka 'sa')
* services (aka 'svc')
`
usage_template = `{{if gt .Aliases 0}}
Aliases:
{{.NameAndAliases}}{{end}}{{if .HasExample}}
Examples:
{{ .Example }}{{end}}{{ if .HasAvailableSubCommands}}
Available Sub-commands:{{range .Commands}}{{if .IsAvailableCommand}}
{{rpad .Name .NamePadding }} {{.Short}}{{end}}{{end}}{{end}}{{ if .HasLocalFlags}}
Flags:
{{.LocalFlags.FlagUsages | trimRightSpace}}{{end}}{{ if .HasInheritedFlags}}
Global Flags:
{{.InheritedFlags.FlagUsages | trimRightSpace}}{{end}}{{if .HasHelpSubCommands}}
Additional help topics:{{range .Commands}}{{if .IsHelpCommand}}
{{rpad .CommandPath .CommandPathPadding}} {{.Short}}{{end}}{{end}}{{end}}
Usage:{{if .Runnable}}
{{if .HasFlags}}{{appendIfNotPresent .UseLine "[flags]"}}{{else}}{{.UseLine}}{{end}}{{end}}{{ if .HasSubCommands }}
{{ .CommandPath}} [command]
Use "{{.CommandPath}} [command] --help" for more information about a command.{{end}}
`
help_template = `{{with or .Long .Short }}{{. | trim}}{{end}}{{if or .Runnable .HasSubCommands}}{{.UsageString}}{{end}}`
)
// NewKubectlCommand creates the `kubectl` command and its nested children.