Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DisableFlagParsing: positional completion is repeated #962

Closed
2 of 11 tasks
rsteube opened this issue Dec 19, 2023 · 0 comments · Fixed by #963
Closed
2 of 11 tasks

DisableFlagParsing: positional completion is repeated #962

rsteube opened this issue Dec 19, 2023 · 0 comments · Fixed by #963
Labels
bug Something isn't working

Comments

@rsteube
Copy link
Member

rsteube commented Dec 19, 2023

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"),
	)
}
@rsteube rsteube added the bug Something isn't working label Dec 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant