-
Notifications
You must be signed in to change notification settings - Fork 264
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Set aliases using usage template #1045
Comments
Is the goal here for just docs or to include in help command as well? Something like below could very easily be added for help:
While updating |
I think having
section for help text should do, I'd remove the inline hint of alias from the short description, in favor of former. |
looks like tkn is controlling the help text using usage template https://github.com/tektoncd/cli/blob/master/pkg/cmd/root.go#L43 |
Yes, I put together something like below for sectionAliases = `{{ if ne (len .Aliases) 0}}Aliases:
{{.NameAndAliases}}
{{end}}`
// sectionTipsHelp is the help template section that displays the '--help' hint.
sectionTipsHelp = `{{if .HasSubCommands}}Use "{{rootCmdName}} <command> --help" for more information about a given command.
{{end}}`
// sectionTipsGlobalOptions is the help template section that displays the 'options' hint for displaying global flags.
sectionTipsGlobalOptions = `Use "{{rootCmdName}} options" for a list of global command-line options (applies to all commands).`
)
// usageTemplate if the template for 'usage' used by most commands.
func usageTemplate() string {
sections := []string{
"\n\n",
sectionExamples,
sectionCommandGroups,
sectionSubCommands,
sectionPlugins,
sectionFlags,
sectionUsage,
sectionAliases,
sectionTipsHelp,
sectionTipsGlobalOptions,
}
return strings.TrimRightFunc(strings.Join(sections, ""), unicode.IsSpace) + "\n"
} Can put in a pr if it makes sense. |
nice! How about re-ordering of the subsections as:
|
Sure, sounds good. Let me rearrange and I'll submit something. |
Currently we've to manually document the aliases for the commands and flags, that should've been added by auto doc utility from cobra.
ref: #1041
The text was updated successfully, but these errors were encountered: