Skip to content

doc: Update instructions on using native-completions #15480

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/doc/src/reference/unstable.md
Original file line number Diff line number Diff line change
Expand Up @@ -1816,10 +1816,10 @@ When in doubt, you can discuss this in [#14520](https://github.com/rust-lang/car

### How to use native-completions feature:
- bash:
Add `source <(CARGO_COMPLETE=bash cargo +nightly)` to your .bashrc.
Add `source <(CARGO_COMPLETE=bash cargo +nightly)` to `~/.local/share/bash-completion/completions/cargo`.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Or make it XDG_DATA_HOME, which

Copy link
Author

@PRO-2684 PRO-2684 May 3, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Or make it XDG_DATA_HOME

Maybe some fallback method should be mentioned, in case the env var doesn't exist?

Copy link
Author

@PRO-2684 PRO-2684 May 3, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

According to the code, the .local/share directory will be used as a fallback for XDG_DATA_HOME.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The suggested fallback of XDG_DATA_HOME is exactly $HOME/.local/share. I think saying XDG_DATA_HOME is good enough, alike elvish and fish.

https://specifications.freedesktop.org/basedir-spec/latest/#variables


- zsh:
Add `source <(CARGO_COMPLETE=zsh cargo +nightly)` to your .zshrc.
Add `source <(CARGO_COMPLETE=zsh cargo +nightly)` to your `.zshrc`.

- fish:
Add `source (CARGO_COMPLETE=fish cargo +nightly | psub)` to `$XDG_CONFIG_HOME/fish/completions/cargo.fish`
Expand Down