Add support for shell-completions file generation #76
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Closes #67
Hello @bradlarsen ! 👋
I worked on this very tiny issue for fun if you don't mind.
As you suggested in the issue, I used
arg_complete
.A future improvement would be to generate these completion files at compile time, with the
build.rs
.https://docs.rs/clap_complete/latest/clap_complete/generator/fn.generate_to.html
By installing Nosey Parker with an install script (package or
cargo install
for example), or even inside a Docker image, we could add auto-completion at install time.Usage
If you quickly test with
zsh
for example :If you want to permanently add the completions to
bash
on Linux :noseyparker shell-completions --shell=bash > noseyparker.bash sudo mv noseyparker.bash /usr/share/bash-completion/completions/
Example
There is five possible values for the shell format :
Here is the look when you toggle
TAB
for example for justnoseyparker
withzsh
:Or with
shell-completions --shell
:Completions seems to work for every commands.
I tested with
zsh
andbash
.Can you tell me if I should fix something ? 😄
Thanks !