From 33e3ac194f892d993afde4f5c5076334839ec976 Mon Sep 17 00:00:00 2001 From: Harald Albers Date: Mon, 20 Jan 2025 08:17:22 +0000 Subject: [PATCH] Be more explicit about the default ShellCompDirective --- completions.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/completions.go b/completions.go index 7c501fd..0c5c2ec 100644 --- a/completions.go +++ b/completions.go @@ -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