-
Notifications
You must be signed in to change notification settings - Fork 4
Shell completion (wrapping clap_complete) #28
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
Conversation
|
this looks great to me! it strikes a good balance of the competing concerns ideally we'd have our own version of the |
|
Good call. I've wrapped clap_complete::aot::Shell with our own Shell enum. Tomorrow, I will investigate if we can flesh out some of the other completion types, or maybe this is good enough. |
|
I tried to make a new ValueEnum trait and add the As a hint, this is how you could hard-code the options for the ... and then you'll get tab completion for the variants: On the other hand, the current PR gets you 80% of the way there without a lot of API debt, so I would be happy if this much was merged. |
|
this looks great -- there's a CI failure for tests that rely on features but don't have those features active when they run. the way i fixed this for the serde tests was to stick this at the top of the test file: however that is minor, and i think i'll just merge and fix it after. i think i also need to have a test run that tests with all features enabled, before now we only had default and no-default-features |
|
i made a PR here where I'm going to iterate on CI thanks for this, when things are green i'm going to cut 0.4.5 release |
This fixes #26
This implementation creates a new optional Cargo feature named "completion" and wraps clap_complete. This is specific to the goal of shell completion, and does not have any other refactoring for exposing the clap::Command in general.
The interface here is Conf structure in ---> Shell script out, while hiding all the clap stuff. The one exception is we need to re-export clap_complete::aot::Shell enum so the user can specify the shell language.
Check out the included
completion_example.shscript that handles the testing of the Tab completion in Bash.