Skip to content

Commit

Permalink
Include help command in completions
Browse files Browse the repository at this point in the history
Based on the change in #1065
for #1000

Signed-off-by: Marc Khouzam <[email protected]>
  • Loading branch information
marckhouzam committed Apr 1, 2020
1 parent c48e845 commit da428b5
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion custom_completions.go
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ func (c *Command) getCompletions(args []string) (*Command, []string, BashCompDir
if flag == nil {
// Complete subcommand names
for _, subCmd := range finalCmd.Commands() {
if subCmd.IsAvailableCommand() && strings.HasPrefix(subCmd.Name(), toComplete) {
if (subCmd.IsAvailableCommand() || subCmd == subCmd.Root().helpCommand) && strings.HasPrefix(subCmd.Name(), toComplete) {
comp := subCmd.Name()
if includeDesc {
comp = fmt.Sprintf("%s\t%s", comp, subCmd.Short)
Expand Down

0 comments on commit da428b5

Please sign in to comment.