1
0
Fork 0
mirror of https://github.com/spf13/cobra synced 2025-04-01 20:39:12 +00:00

Update flagCompletion logic to respect HasCustomFlagCompletion method

This commit is contained in:
Francis Nickels 2025-03-03 14:41:38 -08:00
parent f59f7ace14
commit eeca8112eb

View file

@ -358,7 +358,7 @@ func (c *Command) getCompletions(args []string) (*Command, []Completion, ShellCo
// This works by counting the arguments. Normally -- is not counted as arg but
// if -- was already set or interspersed is false and there is already one arg then
// the extra added -- is counted as arg.
flagCompletion := true
flagCompletion := !finalCmd.HasCustomFlagCompletion()
_ = finalCmd.ParseFlags(append(finalArgs, "--"))
newArgCount := finalCmd.Flags().NArg()