mirror of
https://github.com/spf13/cobra
synced 2025-05-05 12:57:22 +00:00
Uppercase first char in short desc of generate command
This commit provides consistency of the letter casing in the short description between commands. Both the short description as well as documented examples have the first character in the short description in uppercase. The generate command was the exception by having the first character of the short description in lowercase, creating an inconsistent help menu for the user: ```sh Available Commands: add Add a command to a Cobra Application completion generate the autocompletion script for the specified shell help Help about any command init Initialize a Cobra Application ``` * User Guide Example: https://github.com/spf13/cobra/blob/v1.2.1/user_guide.md#example * Help command: https://github.com/spf13/cobra/blob/master/command.go#L1080
This commit is contained in:
parent
4fd30b69ee
commit
48c8f1cb7d
2 changed files with 4 additions and 4 deletions
|
@ -589,7 +589,7 @@ func (c *Command) initDefaultCompletionCmd() {
|
||||||
|
|
||||||
completionCmd := &Command{
|
completionCmd := &Command{
|
||||||
Use: compCmdName,
|
Use: compCmdName,
|
||||||
Short: "generate the autocompletion script for the specified shell",
|
Short: "Generate the autocompletion script for the specified shell",
|
||||||
Long: fmt.Sprintf(`
|
Long: fmt.Sprintf(`
|
||||||
Generate the autocompletion script for %[1]s for the specified shell.
|
Generate the autocompletion script for %[1]s for the specified shell.
|
||||||
See each sub-command's help for details on how to use the generated script.
|
See each sub-command's help for details on how to use the generated script.
|
||||||
|
@ -601,7 +601,7 @@ See each sub-command's help for details on how to use the generated script.
|
||||||
|
|
||||||
out := c.OutOrStdout()
|
out := c.OutOrStdout()
|
||||||
noDesc := c.CompletionOptions.DisableDescriptions
|
noDesc := c.CompletionOptions.DisableDescriptions
|
||||||
shortDesc := "generate the autocompletion script for %s"
|
shortDesc := "Generate the autocompletion script for %s"
|
||||||
bash := &Command{
|
bash := &Command{
|
||||||
Use: "bash",
|
Use: "bash",
|
||||||
Short: fmt.Sprintf(shortDesc, "bash"),
|
Short: fmt.Sprintf(shortDesc, "bash"),
|
||||||
|
|
|
@ -125,7 +125,7 @@ func TestCmdNameCompletionInGo(t *testing.T) {
|
||||||
|
|
||||||
expected = strings.Join([]string{
|
expected = strings.Join([]string{
|
||||||
"aliased\tA command with aliases",
|
"aliased\tA command with aliases",
|
||||||
"completion\tgenerate the autocompletion script for the specified shell",
|
"completion\tGenerate the autocompletion script for the specified shell",
|
||||||
"firstChild\tFirst command",
|
"firstChild\tFirst command",
|
||||||
"help\tHelp about any command",
|
"help\tHelp about any command",
|
||||||
"secondChild",
|
"secondChild",
|
||||||
|
@ -580,7 +580,7 @@ func TestFlagNameCompletionInGoWithDesc(t *testing.T) {
|
||||||
|
|
||||||
expected := strings.Join([]string{
|
expected := strings.Join([]string{
|
||||||
"childCmd\tfirst command",
|
"childCmd\tfirst command",
|
||||||
"completion\tgenerate the autocompletion script for the specified shell",
|
"completion\tGenerate the autocompletion script for the specified shell",
|
||||||
"help\tHelp about any command",
|
"help\tHelp about any command",
|
||||||
":4",
|
":4",
|
||||||
"Completion ended with directive: ShellCompDirectiveNoFileComp", ""}, "\n")
|
"Completion ended with directive: ShellCompDirectiveNoFileComp", ""}, "\n")
|
||||||
|
|
Loading…
Add table
Reference in a new issue