Be more explicit about the default ShellCompDirective

This commit is contained in:
Harald Albers 2025-01-20 08:17:22 +00:00
parent 440c33b3b3
commit 33e3ac194f

View file

@ -454,7 +454,13 @@ func (c *Command) getCompletions(args []string) (*Command, []string, ShellCompDi
return finalCmd, completions, directive, nil
}
} else {
directive = finalCmd.CompletionOptions.DefaultShellCompDirective
customShellCompDirective := finalCmd.CompletionOptions.DefaultShellCompDirective
if customShellCompDirective != ShellCompDirectiveDefault {
directive = customShellCompDirective
} else {
directive = ShellCompDirectiveDefault
}
if flag == nil {
foundLocalNonPersistentFlag := false
// If TraverseChildren is true on the root command we don't check for