Skip to content

Commit 88411f4

Browse files
authored
fix(completions): don't wrap completion item help in parenthesis (#16215)
### What does this PR try to resolve? Fish shell automatically wraps the help text in parenthesis, so this wil result in them being applied twice. <img width="1426" height="197" alt="image" src="https://github.com/user-attachments/assets/cc9529b3-beb4-473d-908a-7f467b6bb4bf" /> On zsh it previously looked like this ``` --target-dir -- Directory for all generated artifacts --timings -- Timing output formats (unstable) (comma separated): html, json --unit-graph -- Output build graph in JSON (unstable) --verbose -- Use verbose output (-vv very verbose/build.rs output) -Z -- Unstable (nightly-only) flags to Cargo, see 'cargo -Z help' for details fix-json -- (from rustfix) matches -- (from cargo-platform) stdout-redirected file-provider -- (from cargo-credential) ``` and will now be ``` fix-json -- from rustfix matches -- from cargo-platform stdout-redirected file-provider -- from cargo-credential ``` Bash doesn't show the help text at all so it doesn't matter.
2 parents 1e4db68 + f0ca6ea commit 88411f4

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/cargo/util/command_prelude.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1218,7 +1218,7 @@ fn get_feature_candidates() -> CargoResult<Vec<clap_complete::CompletionCandidat
12181218
feature_candidates.push(
12191219
clap_complete::CompletionCandidate::new(feature_name)
12201220
.display_order(Some(order))
1221-
.help(Some(format!("(from {})", package_name).into())),
1221+
.help(Some(format!("from {}", package_name).into())),
12221222
);
12231223
}
12241224
}
@@ -1243,7 +1243,7 @@ fn get_crate_candidates(kind: TargetKind) -> CargoResult<Vec<clap_complete::Comp
12431243
};
12441244
clap_complete::CompletionCandidate::new(target.name())
12451245
.display_order(Some(order))
1246-
.help(Some(format!("(from {})", pkg_name).into()))
1246+
.help(Some(format!("from {}", pkg_name).into()))
12471247
})
12481248
.collect::<Vec<_>>();
12491249

0 commit comments

Comments
 (0)