cargo icon indicating copy to clipboard operation
cargo copied to clipboard

feat(cli): Add support for completing `--config` argument values with `native-completions`

Open nspin opened this issue 1 month ago • 1 comments

Add value_hint for the global --config argument to allow completing its value.

The related https://github.com/rust-lang/cargo/pull/16245#issuecomment-3524529383 adds partial support to src/etc/cargo.bashcomp.sh.

What does this PR try to resolve?

Currently, native-completions supports completing the --config flag itself, but not its argument value. This PR adds support for completing its value with a file path (clap::ValueHint::FilePath).

How to test and review this PR?

In a shell supported by native-completions, run:

source <(CARGO_COMPLETE=bash cargo run)

Then, observe that the following completion behaves as expected. That is, the user is prompted with files paths.

cargo --config <tab>

nspin avatar Nov 13 '25 01:11 nspin

r? @ehuss

rustbot has assigned @ehuss. They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

rustbot avatar Nov 13 '25 01:11 rustbot