Problem you are trying to solve
To utilize rustup completions, you are suggested to run rustup completions every time login shell is opened https://rust-lang.github.io/rustup/installation/index.html#enable-tab-completion-for-bash-fish-zsh-or-powershell. On some machines, this may drastically affect shell startup time
Solution you'd like
rustup completions can be called in a rustup internal post-install routine and generate proper completion files after updating or switching toolchain (or at first install); users will be able to source pre-baked completion files without calling rustup each time they login to shell
Notes
An example of how this process may look for zsh:
- calling
rustup update alters rustup and cargo versions, new cli arguments are added
- after successful update, a post-install routine of completion generation started:
rustup completions zsh rustup >$RUSTUP_HOME/completions/_rustup makes completions for rustup
rustup completions zsh cargo >$CARGO_HOME/completions/_cargo makes completions for cargo
- performing
rm -f ~/.zcompdump; compinit to reset and reload completions in zsh
- if user has
FPATH="$RUSTUP_HOME/completions:$CARGO_HOME/completions:$FPATH" in their .zshrc, the completions will work and be up-to-date