-
Notifications
You must be signed in to change notification settings - Fork 36
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
cmd: add 'completion' command #158
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Other than the minor extension of the README, this LGTM. This feature is very cool, thanks a lot for the contribution!
3c1749f
to
44fd212
Compare
I have added a note that links to the relevant documentation for the most common shells. I don't know enough about different shells, and would worry that any specific advise is not universally correct :) It really depends not just on which shell you are using, but also how it is configured (things like oh-my-zsh/bash tend to mess with this sort of thing). Plus it seems like the kind of info that may become out-of-date quickly.. Let me know if you want more - but if so would probably be good if someone with a little more linux/unix/shell background does that. On this note: I don't know if there is a "best practice" for submitting such completion scripts to any online repositories (such as https://github.com/zsh-users/zsh-completions), or if they would even accept an auto generated script like this. May be worth investigating. Similarly I don't know if it would be appropriate/expected behavior for the init.sh script or Arch AUR PKGBUILD to include installation of these completion scripts? I would worry about that being a little brittle/causing problems, but really would improved the user experience. |
I also noticed that the 'help'/'about' text for some subcommands/args is rather long. For example 'vendor': Splitting those into a short 'about' and full 'long_about' 1 would make the completions much nicer. Happy to do that (in here or a separate PR) if desired. Footnotes |
Long helps/abouts have been split. I don't know if there is a 'standard' for long help texts: Should they manually be split into lines (to say 80 cols) or should they be on one line and rely on terminal wrapping. At the moment I left them on one line, as they were before. I also added a note the help text of
|
c60bbdb
to
d4e9296
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! Can you rebase on master? Then I will merge.
Add `bender completion` command that generates completion scripts for common shells (bash, zsh, fish, ...) using clap's clap_complete crate.
Split long helps/abouts into short and long version to cleanup suggestions during autocomplete.
Adds a short note to the end of the help output of all commands that take a subcommand, that directs users to the help text of those subcommands.
d4e9296
to
6540fe6
Compare
@micprog done. |
This PR adds a
bender completion
command that generates completion scripts for common shells (bash, zsh, fish, ...) using clap's clap_complete crate.Example: https://asciinema.org/a/V3kPpxB7TCHRS1BJlRfYyhdPT
(Ignore the fact that the recording can't quite deal with unicode and screws up the shell prompt/command :)
It exposes all the shells supported by clap_complete:
I am not sure about benders compatibility with windows, it may make sense to remove powershell if it is anyway not supported.
Happy to rework this, if it is not quite fitting in its current state:)