Skip to content

Commit

Permalink
feat: Support '-F' as an alias for '--features'
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
epage authored and Hezuikn committed Sep 22, 2022
1 parent d85720a commit aa44ddb
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 8 deletions.
13 changes: 8 additions & 5 deletions src/cargo/util/command_prelude.rs
Original file line number Diff line number Diff line change
Expand Up @@ -132,11 +132,14 @@ pub trait AppExt: Sized {
}

fn arg_features(self) -> Self {
self._arg(multi_opt(
"features",
"FEATURES",
"Space or comma separated list of features to activate",
))
self._arg(
multi_opt(
"features",
"FEATURES",
"Space or comma separated list of features to activate",
)
.short('F'),
)
._arg(opt("all-features", "Activate all available features"))
._arg(opt(
"no-default-features",
Expand Down
4 changes: 2 additions & 2 deletions src/etc/_cargo
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@ _cargo() {
)

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

Expand Down
2 changes: 1 addition & 1 deletion src/etc/cargo.bashcomp.sh
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ _cargo()
local opt_common="$opt_help $opt_verbose $opt_quiet $opt_color"
local opt_pkg_spec='-p --package --all --exclude --workspace'
local opt_pkg='-p --package'
local opt_feat='--features --all-features --no-default-features'
local opt_feat='-F --features --all-features --no-default-features'
local opt_mani='--manifest-path'
local opt_parallel='-j --jobs --keep-going'
local opt_force='-f --force'
Expand Down

0 comments on commit aa44ddb

Please sign in to comment.