Skip to content

Commit fb6dec1

Browse files
committed
Fix:(issue_2105) Ensure fish completion works
1 parent ec67da6 commit fb6dec1

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

command_setup.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ func (cmd *Command) setupDefaults(osArgs []string) {
8888
cmd.SuggestCommandFunc = suggestCommand
8989
}
9090

91-
if cmd.EnableShellCompletion || cmd.Root().shellCompletion {
91+
if isRoot {
9292
completionCommand := buildCompletionCommand(cmd.Name)
9393

9494
if cmd.ShellCompletionCommandName != "" {

completion.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ var (
3030
return fmt.Sprintf(string(b), appName), err
3131
},
3232
"fish": func(c *Command, appName string) (string, error) {
33-
return c.ToFishCompletion()
33+
return c.Root().ToFishCompletion()
3434
},
3535
"pwsh": func(c *Command, appName string) (string, error) {
3636
b, err := autoCompleteFS.ReadFile("autocomplete/powershell_autocomplete.ps1")

0 commit comments

Comments
 (0)