From 19d9b2b03dbadc5c9386b895ef6aaeed8c113adb Mon Sep 17 00:00:00 2001 From: rsteube Date: Tue, 19 Dec 2023 12:50:56 +0100 Subject: [PATCH] FlagParsingDisabled: fix positional completion --- defaultActions.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/defaultActions.go b/defaultActions.go index 2d1df6ad9..dc7d28cf0 100644 --- a/defaultActions.go +++ b/defaultActions.go @@ -529,7 +529,11 @@ func ActionCobra(f func(cmd *cobra.Command, args []string, toComplete string) ([ LOG.Print("cmd is nil [ActionCobra]") c.cmd = &cobra.Command{Use: "_carapace_actioncobra", Hidden: true, Deprecated: "dummy command for ActionCobra"} } - values, directive := f(c.cmd, c.cmd.Flags().Args(), c.Value) + + if !c.cmd.DisableFlagParsing { + c.Args = c.cmd.Flags().Args() + } + values, directive := f(c.cmd, c.Args, c.Value) return compDirective(directive).ToA(values...) }) }