I've been using it for almost a week and seems great! I only miss tab completions, that would be awesome :slight_smile: thanks Brian!
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.
I wonder if we might further frob the shell startup files (like we already to to modify PATH) to load completions.
FWIW, in my case I use zsh and I enable the cargo auto completions (that rustup installs) without touching the /etc directory by modifying the fpath variable in my zshrc as shown here. I also use the oh-my-zsh framework and I've noticed that I need to modify the fpath variable before sourcing the oh-my-zsh framework.
Disclaimer: I don't really grok zsh internals and perhaps there is a way to enable cargo autocompletions after the oh-my-zsh framework has been loaded.
P.S. I don't really like that CLI tools modify my zshrc, I usually undo/modify what they do :smile:. I would be happy if rustup just installs a _rustup completion file somewhere in the .multirust folder like it does with _cargo.
@brson @japaric
I've just added the ability to generate bash completions for a cli with clap at compile time. Here's a gist of the generated completion script for rustup
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
rustup_mode::cli function into a separate file in order to include via the build.rs. use help::*; from rustup_app.rs so I had to include! it.OUT_DIRGranted 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!
@knight42
I've just added ZSH support to clap (finally! :tada:), and put in a PR to rustup to add it. The PR also includes Bash, and Fish support as well.
Here's a gif of the ZSH support though:

@kbknapp Awesome, love it!
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 rustup override add<TAB><TAB> it should give you a list of toolchains.
Its obviously more complicated, but should be doable, no?
flatpak manages to do this btw, you can press flatpak run org.app.<TAB> and it will autocomplete the app name.
@est31 not yet, but that is the exact topic of kbknapp/clap-rs#568
I should add you can do this manually, but it's not built in to clap yet :will:
I think this can be considered complete?
Most helpful comment
@brson @japaric
I've just added the ability to generate bash completions for a cli with
clapat compile time. Here's a gist of the generated completion script forrustupAnd 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
rustup_mode::clifunction into a separate file in order to include via thebuild.rs.use help::*;fromrustup_app.rsso I had toinclude!it.OUT_DIRGranted 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.