Skip to content

Commit c3573e2

Browse files
authored
Completion: Capitalize short desc, and remove extra space from long (#1455)
1 parent dd40ab0 commit c3573e2

File tree

2 files changed

+9
-14
lines changed

2 files changed

+9
-14
lines changed

completions.go

+7-12
Original file line numberDiff line numberDiff line change
@@ -599,9 +599,8 @@ func (c *Command) initDefaultCompletionCmd() {
599599

600600
completionCmd := &Command{
601601
Use: compCmdName,
602-
Short: "generate the autocompletion script for the specified shell",
603-
Long: fmt.Sprintf(`
604-
Generate the autocompletion script for %[1]s for the specified shell.
602+
Short: "Generate the autocompletion script for the specified shell",
603+
Long: fmt.Sprintf(`Generate the autocompletion script for %[1]s for the specified shell.
605604
See each sub-command's help for details on how to use the generated script.
606605
`, c.Root().Name()),
607606
Args: NoArgs,
@@ -611,12 +610,11 @@ See each sub-command's help for details on how to use the generated script.
611610

612611
out := c.OutOrStdout()
613612
noDesc := c.CompletionOptions.DisableDescriptions
614-
shortDesc := "generate the autocompletion script for %s"
613+
shortDesc := "Generate the autocompletion script for %s"
615614
bash := &Command{
616615
Use: "bash",
617616
Short: fmt.Sprintf(shortDesc, "bash"),
618-
Long: fmt.Sprintf(`
619-
Generate the autocompletion script for the bash shell.
617+
Long: fmt.Sprintf(`Generate the autocompletion script for the bash shell.
620618
621619
This script depends on the 'bash-completion' package.
622620
If it is not installed already, you can install it via your OS's package manager.
@@ -651,8 +649,7 @@ You will need to start a new shell for this setup to take effect.
651649
zsh := &Command{
652650
Use: "zsh",
653651
Short: fmt.Sprintf(shortDesc, "zsh"),
654-
Long: fmt.Sprintf(`
655-
Generate the autocompletion script for the zsh shell.
652+
Long: fmt.Sprintf(`Generate the autocompletion script for the zsh shell.
656653
657654
If shell completion is not already enabled in your environment you will need
658655
to enable it. You can execute the following once:
@@ -687,8 +684,7 @@ You will need to start a new shell for this setup to take effect.
687684
fish := &Command{
688685
Use: "fish",
689686
Short: fmt.Sprintf(shortDesc, "fish"),
690-
Long: fmt.Sprintf(`
691-
Generate the autocompletion script for the fish shell.
687+
Long: fmt.Sprintf(`Generate the autocompletion script for the fish shell.
692688
693689
To load completions in your current shell session:
694690
@@ -713,8 +709,7 @@ You will need to start a new shell for this setup to take effect.
713709
powershell := &Command{
714710
Use: "powershell",
715711
Short: fmt.Sprintf(shortDesc, "powershell"),
716-
Long: fmt.Sprintf(`
717-
Generate the autocompletion script for powershell.
712+
Long: fmt.Sprintf(`Generate the autocompletion script for powershell.
718713
719714
To load completions in your current shell session:
720715

completions_test.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ func TestCmdNameCompletionInGo(t *testing.T) {
125125

126126
expected = strings.Join([]string{
127127
"aliased\tA command with aliases",
128-
"completion\tgenerate the autocompletion script for the specified shell",
128+
"completion\tGenerate the autocompletion script for the specified shell",
129129
"firstChild\tFirst command",
130130
"help\tHelp about any command",
131131
"secondChild",
@@ -580,7 +580,7 @@ func TestFlagNameCompletionInGoWithDesc(t *testing.T) {
580580

581581
expected := strings.Join([]string{
582582
"childCmd\tfirst command",
583-
"completion\tgenerate the autocompletion script for the specified shell",
583+
"completion\tGenerate the autocompletion script for the specified shell",
584584
"help\tHelp about any command",
585585
":4",
586586
"Completion ended with directive: ShellCompDirectiveNoFileComp", ""}, "\n")

0 commit comments

Comments
 (0)