Skip to content

Commit 9fe1d0d

Browse files
fcjrumarcor
authored andcommitted
Completion: Capitalize short desc, and remove extra space from long (spf13#1455)
1 parent ecb08bc commit 9fe1d0d

File tree

2 files changed

+9
-14
lines changed

2 files changed

+9
-14
lines changed

completions.go

Lines changed: 7 additions & 12 deletions
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.
@@ -646,8 +644,7 @@ You will need to start a new shell for this setup to take effect.
646644
zsh := &Command{
647645
Use: "zsh",
648646
Short: fmt.Sprintf(shortDesc, "zsh"),
649-
Long: fmt.Sprintf(`
650-
Generate the autocompletion script for the zsh shell.
647+
Long: fmt.Sprintf(`Generate the autocompletion script for the zsh shell.
651648
652649
If shell completion is not already enabled in your environment you will need
653650
to enable it. You can execute the following once:
@@ -678,8 +675,7 @@ You will need to start a new shell for this setup to take effect.
678675
fish := &Command{
679676
Use: "fish",
680677
Short: fmt.Sprintf(shortDesc, "fish"),
681-
Long: fmt.Sprintf(`
682-
Generate the autocompletion script for the fish shell.
678+
Long: fmt.Sprintf(`Generate the autocompletion script for the fish shell.
683679
684680
To load completions in your current shell session:
685681
$ %[1]s completion fish | source
@@ -702,8 +698,7 @@ You will need to start a new shell for this setup to take effect.
702698
powershell := &Command{
703699
Use: "powershell",
704700
Short: fmt.Sprintf(shortDesc, "powershell"),
705-
Long: fmt.Sprintf(`
706-
Generate the autocompletion script for powershell.
701+
Long: fmt.Sprintf(`Generate the autocompletion script for powershell.
707702
708703
To load completions in your current shell session:
709704
PS C:\> %[1]s completion powershell | Out-String | Invoke-Expression

completions_test.go

Lines changed: 2 additions & 2 deletions
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)