-
Notifications
You must be signed in to change notification settings - Fork 892
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
tab completions #278
Comments
FWIW, in my case I use Disclaimer: I don't really grok zsh internals and perhaps there is a way to enable P.S. I don't really like that CLI tools modify my zshrc, I usually undo/modify what they do 😄. I would be happy if |
I've just added the ability to generate bash completions for a cli with And a demo: I have a branch on my fork where I generated the completions, although before I'd put in a PR there are few opinionated portions that I'd rather a project maintainer look at prior
Granted this is only a Bash completion script, but it's at least a step in a direction (if it's the right direction is TBD). I personally use ZSH, so that's next on my list. |
@kbknapp Wow, that's awesome! |
go go go |
@kbknapp Sweet! That's really clever. I'm fine doing the conversion, but I'd still like to wait until we understand how to install them before pulling trigger. |
@kbknapp Any progress now? It's a pain to me when auto-completion is unable to use. |
@knight42 I haven't added ZSH support yet. Once I do I'll post back here. |
@kbknapp Great! It's better to generate the completion script automatically. I am looking forward to it! |
This commit adds two sections to the command line options to enable building of Shell Completion Scripts to `stdout`. This allows these scripts to be redirected to a file, effectively allowing the user to install these scripts at the location of their choosing. The arguments only accept the values `zsh`, `fish` and `bash`, which clap guards against. To use these scripts one must do one of the following *Note:* The commands `rustup completions <SHELL>` and `rustup self --completions <SHELL>` are synonyms for each other, and do the exact same thing. ``` $ rustup completions bash > /path/to/completions/dir/rustup.bash-completion ``` ``` $ rustup completions fish > ~/.config/fish/completions/rustup.fish ``` ``` $ mkdir ~/.zfunc $ rustup completions zsh > ~/.zfunc/_rustup $ echo "fpath+=~/.zfunc\ncominit" >> ~/.zshrc $ exec zsh ``` Relates to rust-lang#278
I've just added ZSH support to Here's a gif of the ZSH support though: |
@kbknapp Awesome, love it! |
This commit adds two sections to the command line options to enable building of Shell Completion Scripts to `stdout`. This allows these scripts to be redirected to a file, effectively allowing the user to install these scripts at the location of their choosing. The arguments only accept the values `zsh`, `fish` and `bash`, which clap guards against. To use these scripts one must do one of the following *Note:* The commands `rustup completions <SHELL>` and `rustup self --completions <SHELL>` are synonyms for each other, and do the exact same thing. ``` $ rustup completions bash > /path/to/completions/dir/rustup.bash-completion ``` ``` $ rustup completions fish > ~/.config/fish/completions/rustup.fish ``` ``` $ mkdir ~/.zfunc $ rustup completions zsh > ~/.zfunc/_rustup $ echo "fpath+=~/.zfunc\ncominit" >> ~/.zshrc $ exec zsh ``` Relates to rust-lang#278
Thanks for the autocompletion feature @kbknapp I really like it! Would it be possible to extend the tab completion support to include things rustup can derive? Like when you type Its obviously more complicated, but should be doable, no? flatpak manages to do this btw, you can press |
@est31 not yet, but that is the exact topic of clap-rs/clap#568 |
I should add you can do this manually, but it's not built in to clap yet :will: |
This commit adds two sections to the command line options to enable building of Shell Completion Scripts to `stdout`. This allows these scripts to be redirected to a file, effectively allowing the user to install these scripts at the location of their choosing. The arguments only accept the values `zsh`, `fish` and `bash`, which clap guards against. To use these scripts one must do one of the following *Note:* The commands `rustup completions <SHELL>` and `rustup self --completions <SHELL>` are synonyms for each other, and do the exact same thing. ``` $ rustup completions bash > /path/to/completions/dir/rustup.bash-completion ``` ``` $ rustup completions fish > ~/.config/fish/completions/rustup.fish ``` ``` $ mkdir ~/.zfunc $ rustup completions zsh > ~/.zfunc/_rustup $ echo "fpath+=~/.zfunc\ncominit" >> ~/.zshrc $ exec zsh ``` Relates to rust-lang#278
I think this can be considered complete? |
Hm, after thinking about this further, tab completions are going to be tricky. rustup does not require root to install but completions are usually installed to /etc. I really don't want to require admin just for that. I wonder if we might further frob the shell startup files (like we already to to modify PATH) to load completions.
Source.
The text was updated successfully, but these errors were encountered: