carapace-sh/carapace

DisableFlagParsing: positional completion is repeated

rsteube opened this issue · 0 comments

Current Behavior

Positional completion gets repeated when flag parsing is disabled:

example disabled p1 p2 po<TAB>
# positional1

Expected Behavior

Nothing should be completed on the third position.

Steps To Reproduce

No response

Version

0.47.2

OS

  • Linux
  • OSX
  • Windows

Shell

  • Bash
  • Elvish
  • Fish
  • Nushell
  • Oil
  • Powershell
  • Xonsh
  • Zsh

Anything else?

package cmd

import (
	"github.com/rsteube/carapace"
	"github.com/spf13/cobra"
)

var disabledCmd = &cobra.Command{
	Use:                "disabled",
	Short:              "",
	DisableFlagParsing: true,
	Run:                func(cmd *cobra.Command, args []string) {},
}

func init() {
	carapace.Gen(disabledCmd).Standalone()

	rootCmd.AddCommand(disabledCmd)

	carapace.Gen(disabledCmd).PositionalCompletion(
		carapace.ActionValues("p1", "positional1"),
		carapace.ActionValues("p2", "positional2"),
	)
}