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

Zsh completion: Options and flags are not completed when they come after ordered arguments #3249

Open
AndydeCleyre opened this issue Apr 24, 2024 · 8 comments
Labels
bug Something isn't working upstream An upstream dependency is involved

Comments

@AndydeCleyre
Copy link

$ uv pip compile requirements.in --  # mash TAB key here

The command accepts options in this position, but that is not reflected by the current Zsh completion.

$ uv --version
uv 0.1.37
$ uname
Linux
@zanieb
Copy link
Member

zanieb commented Apr 24, 2024

-- is typically used to indicate you are passing options through to another tool. Is there a reason you're using it like this?

@AndydeCleyre
Copy link
Author

Sorry, I wasn't clear -- I'm not using dash, dash, space, but instead: dash, dash, tab

@zanieb
Copy link
Member

zanieb commented Apr 24, 2024

Oh! Thanks for clarifying haha interesting. We don't write our own completion tooling, not sure if we can do anything here. I wonder if this reproduces with a trivial clap example or if there's an issue upstream?

@zanieb zanieb added bug Something isn't working upstream An upstream dependency is involved labels Apr 24, 2024
@charliermarsh
Copy link
Member

Dumb question but just confirming that you went through the steps to generate / install the Zsh completions?

@AndydeCleyre
Copy link
Author

@charliermarsh

Yes, of course, thanks. The completion in general works, but is more sensitive to order than the actual command.

@AndydeCleyre
Copy link
Author

I can't tell if this is or is not describing the same issue: clap-rs/clap#5244

@AndydeCleyre
Copy link
Author

I think prqlc, which also uses clap_complete_command, manages to get this working.

For example:

$ prqlc watch --help
Watch a directory and compile .prql files to .sql files

Usage: prqlc watch [OPTIONS] <PATH>

Arguments:
  <PATH>  Directory or file to watch for changes

Options:
      --no-format     
      --no-signature  
      --color <WHEN>  Controls when to use color [default: auto] [possible values: auto, always, never]
  -h, --help          Print help

$ prqlc watch . --n  # TAB

does complete options for the watch subcommand.

Possibly this is due to its use of clap's derive feature 🤷🏼 .

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working upstream An upstream dependency is involved
Projects
None yet
Development

No branches or pull requests

3 participants