rust-lang / rust-lang/rustup

Generate completion files on toolchain switch or update

Open
#4,152 7 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
Rust
Stars
7k
Forks
1.1k
Avg merge
22h 40m
Merged PRs (30d)
46

Description

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

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the rustup completions, rustup update, and toolchain-switch entry points, and compare the installation guide's shell setup. Trace when post-install generation would run and where RUSTUP_HOME and CARGO_HOME completion files belong. Done means completions are regenerated after install, update, or switch without invoking rustup at shell startup.

Written by the indexing model from the issue text.

Assessment

Tech stack
bash, fish, powershell, rust, zsh
Domain
cli, tooling
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.