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

[bug] zsh completion has wrong order for many nargs=?s #123

Open
Freed-Wu opened this issue Dec 8, 2022 · 0 comments
Open

[bug] zsh completion has wrong order for many nargs=?s #123

Freed-Wu opened this issue Dec 8, 2022 · 0 comments
Labels
p2-nice-to-have Low priority

Comments

@Freed-Wu
Copy link
Contributor

Freed-Wu commented Dec 8, 2022

Such as jaraco/keyring#611

        self.parser.add_argument(
            'operation',
            choices=["get", "set", "del"],
            nargs="?",
        )
        self.parser.add_argument(
            'service',
            nargs="?",
        )
        self.parser.add_argument(
            'username',
            nargs="?",
        )

will generate

_shtab_keyring_options=(
  "(- : *)"{-h,--help}"[show this help message and exit]"
  "(- : *)--print-completion[print shell completion script]:print_completion:(bash zsh tcsh)"
  {-p,--keyring-path}"[Path to the keyring backend]:keyring_path:_files -/"
  {-b,--keyring-backend}"[Name of the keyring backend]:keyring_backend:keyring_complete"
  "--list-backends[List keyring backends and exit]"
  "--disable[Disable keyring and exit]"
  ":service:"
  ":username:"
  ":operation:(get set del)"
)

Expected:

_shtab_keyring_options=(
  "(- : *)"{-h,--help}"[show this help message and exit]"
  "(- : *)--print-completion[print shell completion script]:print_completion:(bash zsh tcsh)"
  {-p,--keyring-path}"[Path to the keyring backend]:keyring_path:_files -/"
  {-b,--keyring-backend}"[Name of the keyring backend]:keyring_backend:keyring_complete"
  "--list-backends[List keyring backends and exit]"
  "--disable[Disable keyring and exit]"
  ":operation:(get set del)"
  ":service:"
  ":username:"
)
@omesser omesser added the p2-nice-to-have Low priority label Mar 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
p2-nice-to-have Low priority
Projects
None yet
Development

No branches or pull requests

2 participants