Skip to content

Commit

Permalink
Fix wrong variable use to generate help message
Browse files Browse the repository at this point in the history
  • Loading branch information
loicsapone committed Nov 15, 2021
1 parent d5b0839 commit 51822a4
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,12 @@ func Execute(version string) {
Args: cobra.NoArgs,
ValidArgsFunction: func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) {
list := make([]string, 0)
for _, cmd := range cmd.Commands() {
if !cmd.IsAvailableCommand() {
for _, c := range cmd.Commands() {
if !c.IsAvailableCommand() {
continue
}

list = append(list, fmt.Sprintf("%s\t%s", cmd.Use, cmd.Short))
list = append(list, fmt.Sprintf("%s\t%s", c.Use, c.Short))
}
return list, cobra.ShellCompDirectiveNoSpace
},
Expand Down
2 changes: 1 addition & 1 deletion internal/cmd/root/help.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import (
func HelpFunc(cmd *cobra.Command, args []string) {
commands := []string{}
for _, c := range cmd.Commands() {
if !cmd.IsAvailableCommand() {
if !c.IsAvailableCommand() {
continue
}

Expand Down

0 comments on commit 51822a4

Please sign in to comment.