-
Notifications
You must be signed in to change notification settings - Fork 2.7k
feat(cli): Add support for completing --config values in Bash
#16245
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
Conversation
Adds support for completing --config values with _filedir, but only when they appear after the cargo subcommand.
|
The first commit, I would be fine merging immediately. The second commit, I don't quite feel qualified to review. If you want to split this PR, then we can get that first commit merged. Note: overall our focused has shifted towards stabilizing https://doc.rust-lang.org/nightly/cargo/reference/unstable.html#native-completions |
87566e1 to
35c827a
Compare
I've removed the second commit from this PR, leaving only the first. The second commit depends on the first, so I'll open that PR after this is merged.
Thanks for the heads up, I'll look into adding this feature over there too. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
|
I've opened #16249, which adds this feature for |
Update cargo submodule 13 commits in 2d4fa139552ebdd5f091a1401ed03f7dc62cb43f..5c0343317ce45d2ec17ecf41eaa473a02d73e29c 2025-11-12 15:56:06 +0000 to 2025-11-18 19:05:44 +0000 - feat: emit a warning when both `package.publish` and `--index` are specified (rust-lang/cargo#16268) - docs(cargo-yank): clarify yank behavior with leaked credentials (rust-lang/cargo#16274) - feat(generate-lockfile): Add unstable --publish-time flag (rust-lang/cargo#16265) - Do not lock the artifact-dir for check builds (rust-lang/cargo#16230) - fix(fingerprint): force update mtime of cargo-check artifacts (rust-lang/cargo#16262) - fix(manifest): Point out when a key belongs to config (rust-lang/cargo#16256) - Use raw false during cfg test (rust-lang/cargo#16261) - Suppress metadata warnings for non–crates.io publishable packages (rust-lang/cargo#16241) - feat(tree): Support long forms for --format variables (rust-lang/cargo#16204) - fix(config): Fallback to non-canonical path for workspace-path-hash (rust-lang/cargo#16248) - fix: update mtime for generated files after unpacking (rust-lang/cargo#16250) - feat(cli): Add support for completing `--config` values in Bash (rust-lang/cargo#16245) - feat: Add a typos CI job (rust-lang/cargo#16122)
Update cargo submodule 13 commits in 2d4fa139552ebdd5f091a1401ed03f7dc62cb43f..5c0343317ce45d2ec17ecf41eaa473a02d73e29c 2025-11-12 15:56:06 +0000 to 2025-11-18 19:05:44 +0000 - feat: emit a warning when both `package.publish` and `--index` are specified (rust-lang/cargo#16268) - docs(cargo-yank): clarify yank behavior with leaked credentials (rust-lang/cargo#16274) - feat(generate-lockfile): Add unstable --publish-time flag (rust-lang/cargo#16265) - Do not lock the artifact-dir for check builds (rust-lang/cargo#16230) - fix(fingerprint): force update mtime of cargo-check artifacts (rust-lang/cargo#16262) - fix(manifest): Point out when a key belongs to config (rust-lang/cargo#16256) - Use raw false during cfg test (rust-lang/cargo#16261) - Suppress metadata warnings for non–crates.io publishable packages (rust-lang/cargo#16241) - feat(tree): Support long forms for --format variables (rust-lang/cargo#16204) - fix(config): Fallback to non-canonical path for workspace-path-hash (rust-lang/cargo#16248) - fix: update mtime for generated files after unpacking (rust-lang/cargo#16250) - feat(cli): Add support for completing `--config` values in Bash (rust-lang/cargo#16245) - feat: Add a typos CI job (rust-lang/cargo#16122)
Update cargo submodule 13 commits in 2d4fa139552ebdd5f091a1401ed03f7dc62cb43f..5c0343317ce45d2ec17ecf41eaa473a02d73e29c 2025-11-12 15:56:06 +0000 to 2025-11-18 19:05:44 +0000 - feat: emit a warning when both `package.publish` and `--index` are specified (rust-lang/cargo#16268) - docs(cargo-yank): clarify yank behavior with leaked credentials (rust-lang/cargo#16274) - feat(generate-lockfile): Add unstable --publish-time flag (rust-lang/cargo#16265) - Do not lock the artifact-dir for check builds (rust-lang/cargo#16230) - fix(fingerprint): force update mtime of cargo-check artifacts (rust-lang/cargo#16262) - fix(manifest): Point out when a key belongs to config (rust-lang/cargo#16256) - Use raw false during cfg test (rust-lang/cargo#16261) - Suppress metadata warnings for non–crates.io publishable packages (rust-lang/cargo#16241) - feat(tree): Support long forms for --format variables (rust-lang/cargo#16204) - fix(config): Fallback to non-canonical path for workspace-path-hash (rust-lang/cargo#16248) - fix: update mtime for generated files after unpacking (rust-lang/cargo#16250) - feat(cli): Add support for completing `--config` values in Bash (rust-lang/cargo#16245) - feat: Add a typos CI job (rust-lang/cargo#16122)
Update cargo submodule 13 commits in 2d4fa139552ebdd5f091a1401ed03f7dc62cb43f..5c0343317ce45d2ec17ecf41eaa473a02d73e29c 2025-11-12 15:56:06 +0000 to 2025-11-18 19:05:44 +0000 - feat: emit a warning when both `package.publish` and `--index` are specified (rust-lang/cargo#16268) - docs(cargo-yank): clarify yank behavior with leaked credentials (rust-lang/cargo#16274) - feat(generate-lockfile): Add unstable --publish-time flag (rust-lang/cargo#16265) - Do not lock the artifact-dir for check builds (rust-lang/cargo#16230) - fix(fingerprint): force update mtime of cargo-check artifacts (rust-lang/cargo#16262) - fix(manifest): Point out when a key belongs to config (rust-lang/cargo#16256) - Use raw false during cfg test (rust-lang/cargo#16261) - Suppress metadata warnings for non–crates.io publishable packages (rust-lang/cargo#16241) - feat(tree): Support long forms for --format variables (rust-lang/cargo#16204) - fix(config): Fallback to non-canonical path for workspace-path-hash (rust-lang/cargo#16248) - fix: update mtime for generated files after unpacking (rust-lang/cargo#16250) - feat(cli): Add support for completing `--config` values in Bash (rust-lang/cargo#16245) - feat: Add a typos CI job (rust-lang/cargo#16122)
What does this PR try to resolve?
Currently,
cargo.bashcomp.shdoesn't support completing the--configflag, let alone its value. This PR adds support for completing both the--configflag and a_filedirvalue for it. This support includes both cases where it appears before the cargo subcommand, and cases where it appears after. In the process of implementing the former, I also added support for completing values for--colorbefore the cargo subcommand. Currently, completing values for--coloris only supported after the cargo subcommand.How to test and review this PR?
In a Bash shell, run:
Then, observe that the following completions behave as expected: