Skip to content

Commit fcd431c

Browse files
epageHezuikn
authored andcommitted
feat: Support '-F' as an alias for '--features'
This decision was part of rust-lang#10472 - It looks like all commands except `cargo-add` are using the prelude to define `--features`, so this should hit them all. - I've updated completions to the best of my knowledge. - It appears we don't need to update man pages or other documentation. - I'm assuming we don't add tests for every sort flag but rely on clap to have coverage to ensure it works.
1 parent 815e85f commit fcd431c

File tree

3 files changed

+11
-8
lines changed

3 files changed

+11
-8
lines changed

src/cargo/util/command_prelude.rs

+8-5
Original file line numberDiff line numberDiff line change
@@ -132,11 +132,14 @@ pub trait AppExt: Sized {
132132
}
133133

134134
fn arg_features(self) -> Self {
135-
self._arg(multi_opt(
136-
"features",
137-
"FEATURES",
138-
"Space or comma separated list of features to activate",
139-
))
135+
self._arg(
136+
multi_opt(
137+
"features",
138+
"FEATURES",
139+
"Space or comma separated list of features to activate",
140+
)
141+
.short('F'),
142+
)
140143
._arg(opt("all-features", "Activate all available features"))
141144
._arg(opt(
142145
"no-default-features",

src/etc/_cargo

+2-2
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,8 @@ _cargo() {
5151
)
5252

5353
features=(
54-
'(--all-features)--features=[specify features to activate]:feature'
55-
'(--features)--all-features[activate all available features]'
54+
'(--all-features)'{-F+,--features=}'[specify features to activate]:feature'
55+
'(--features -F)--all-features[activate all available features]'
5656
"--no-default-features[don't build the default features]"
5757
)
5858

src/etc/cargo.bashcomp.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ _cargo()
3939
local opt_common="$opt_help $opt_verbose $opt_quiet $opt_color"
4040
local opt_pkg_spec='-p --package --all --exclude --workspace'
4141
local opt_pkg='-p --package'
42-
local opt_feat='--features --all-features --no-default-features'
42+
local opt_feat='-F --features --all-features --no-default-features'
4343
local opt_mani='--manifest-path'
4444
local opt_parallel='-j --jobs --keep-going'
4545
local opt_force='-f --force'

0 commit comments

Comments
 (0)