Skip to content

Commit 46c7a2b

Browse files
committed
Auto merge of #10576 - epage:feature, r=weihanglo
feat: Support '-F' as an alias for '--features' ### What does this PR try to resolve? Adds a short flag `-F` for `--features to all cargo commands to be consistent with the `-F` short flag being added in #10472. ### How should we test and review this PR? The decision for this is a part of #10472 which is in FCP. - It looks like all commands except `cargo-add` are using the prelude to define `--features`, so this should hit them all. - Man pages were updated - I've updated completions to the best of my knowledge and am unsure of good testing strategies for them - I'm assuming we don't add tests for every sort flag but rely on clap to have coverage to ensure it works. Review the commits separately. For the documentation change, the only manual change is in `src/doc/man/includes/section-features.md`, the rest are code-generated.
2 parents 1d9ded9 + f728045 commit 46c7a2b

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+54
-23
lines changed

Diff for: 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",

Diff for: src/doc/man/generated_txt/cargo-bench.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ OPTIONS
181181
<https://doc.rust-lang.org/cargo/reference/features.html#command-line-feature-options>
182182
for more details.
183183

184-
--features features
184+
-F features, --features features
185185
Space or comma separated list of features to activate. Features of
186186
workspace members may be enabled with package-name/feature-name
187187
syntax. This flag may be specified multiple times, which enables all

Diff for: src/doc/man/generated_txt/cargo-build.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ OPTIONS
114114
<https://doc.rust-lang.org/cargo/reference/features.html#command-line-feature-options>
115115
for more details.
116116

117-
--features features
117+
-F features, --features features
118118
Space or comma separated list of features to activate. Features of
119119
workspace members may be enabled with package-name/feature-name
120120
syntax. This flag may be specified multiple times, which enables all

Diff for: src/doc/man/generated_txt/cargo-check.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ OPTIONS
120120
<https://doc.rust-lang.org/cargo/reference/features.html#command-line-feature-options>
121121
for more details.
122122

123-
--features features
123+
-F features, --features features
124124
Space or comma separated list of features to activate. Features of
125125
workspace members may be enabled with package-name/feature-name
126126
syntax. This flag may be specified multiple times, which enables all

Diff for: src/doc/man/generated_txt/cargo-doc.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ OPTIONS
9898
<https://doc.rust-lang.org/cargo/reference/features.html#command-line-feature-options>
9999
for more details.
100100

101-
--features features
101+
-F features, --features features
102102
Space or comma separated list of features to activate. Features of
103103
workspace members may be enabled with package-name/feature-name
104104
syntax. This flag may be specified multiple times, which enables all

Diff for: src/doc/man/generated_txt/cargo-fix.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ OPTIONS
193193
<https://doc.rust-lang.org/cargo/reference/features.html#command-line-feature-options>
194194
for more details.
195195

196-
--features features
196+
-F features, --features features
197197
Space or comma separated list of features to activate. Features of
198198
workspace members may be enabled with package-name/feature-name
199199
syntax. This flag may be specified multiple times, which enables all

Diff for: src/doc/man/generated_txt/cargo-install.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ OPTIONS
157157
<https://doc.rust-lang.org/cargo/reference/features.html#command-line-feature-options>
158158
for more details.
159159

160-
--features features
160+
-F features, --features features
161161
Space or comma separated list of features to activate. Features of
162162
workspace members may be enabled with package-name/feature-name
163163
syntax. This flag may be specified multiple times, which enables all

Diff for: src/doc/man/generated_txt/cargo-metadata.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -315,7 +315,7 @@ OPTIONS
315315
<https://doc.rust-lang.org/cargo/reference/features.html#command-line-feature-options>
316316
for more details.
317317

318-
--features features
318+
-F features, --features features
319319
Space or comma separated list of features to activate. Features of
320320
workspace members may be enabled with package-name/feature-name
321321
syntax. This flag may be specified multiple times, which enables all

Diff for: src/doc/man/generated_txt/cargo-package.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ OPTIONS
139139
<https://doc.rust-lang.org/cargo/reference/features.html#command-line-feature-options>
140140
for more details.
141141

142-
--features features
142+
-F features, --features features
143143
Space or comma separated list of features to activate. Features of
144144
workspace members may be enabled with package-name/feature-name
145145
syntax. This flag may be specified multiple times, which enables all

Diff for: src/doc/man/generated_txt/cargo-publish.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ OPTIONS
106106
<https://doc.rust-lang.org/cargo/reference/features.html#command-line-feature-options>
107107
for more details.
108108

109-
--features features
109+
-F features, --features features
110110
Space or comma separated list of features to activate. Features of
111111
workspace members may be enabled with package-name/feature-name
112112
syntax. This flag may be specified multiple times, which enables all

Diff for: src/doc/man/generated_txt/cargo-run.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ OPTIONS
4343
<https://doc.rust-lang.org/cargo/reference/features.html#command-line-feature-options>
4444
for more details.
4545

46-
--features features
46+
-F features, --features features
4747
Space or comma separated list of features to activate. Features of
4848
workspace members may be enabled with package-name/feature-name
4949
syntax. This flag may be specified multiple times, which enables all

Diff for: src/doc/man/generated_txt/cargo-rustc.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ OPTIONS
105105
<https://doc.rust-lang.org/cargo/reference/features.html#command-line-feature-options>
106106
for more details.
107107

108-
--features features
108+
-F features, --features features
109109
Space or comma separated list of features to activate. Features of
110110
workspace members may be enabled with package-name/feature-name
111111
syntax. This flag may be specified multiple times, which enables all

Diff for: src/doc/man/generated_txt/cargo-rustdoc.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ OPTIONS
114114
<https://doc.rust-lang.org/cargo/reference/features.html#command-line-feature-options>
115115
for more details.
116116

117-
--features features
117+
-F features, --features features
118118
Space or comma separated list of features to activate. Features of
119119
workspace members may be enabled with package-name/feature-name
120120
syntax. This flag may be specified multiple times, which enables all

Diff for: src/doc/man/generated_txt/cargo-test.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@ OPTIONS
191191
<https://doc.rust-lang.org/cargo/reference/features.html#command-line-feature-options>
192192
for more details.
193193

194-
--features features
194+
-F features, --features features
195195
Space or comma separated list of features to activate. Features of
196196
workspace members may be enabled with package-name/feature-name
197197
syntax. This flag may be specified multiple times, which enables all

Diff for: src/doc/man/generated_txt/cargo-tree.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,7 @@ OPTIONS
224224
<https://doc.rust-lang.org/cargo/reference/features.html#command-line-feature-options>
225225
for more details.
226226

227-
--features features
227+
-F features, --features features
228228
Space or comma separated list of features to activate. Features of
229229
workspace members may be enabled with package-name/feature-name
230230
syntax. This flag may be specified multiple times, which enables all

Diff for: src/doc/man/includes/section-features.md

+1-1

Diff for: src/doc/src/commands/cargo-bench.md

+1

Diff for: src/doc/src/commands/cargo-build.md

+1

Diff for: src/doc/src/commands/cargo-check.md

+1

Diff for: src/doc/src/commands/cargo-doc.md

+1

Diff for: src/doc/src/commands/cargo-fix.md

+1

Diff for: src/doc/src/commands/cargo-install.md

+1

Diff for: src/doc/src/commands/cargo-metadata.md

+1

Diff for: src/doc/src/commands/cargo-package.md

+1

Diff for: src/doc/src/commands/cargo-publish.md

+1

Diff for: src/doc/src/commands/cargo-run.md

+1

Diff for: src/doc/src/commands/cargo-rustc.md

+1

Diff for: src/doc/src/commands/cargo-rustdoc.md

+1

Diff for: src/doc/src/commands/cargo-test.md

+1

Diff for: src/doc/src/commands/cargo-tree.md

+1

Diff for: 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

Diff for: 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'

Diff for: src/etc/man/cargo-bench.1

+1
Original file line numberDiff line numberDiff line change
@@ -224,6 +224,7 @@ selected package.
224224
See \fIthe features documentation\fR <https://doc.rust\-lang.org/cargo/reference/features.html#command\-line\-feature\-options>
225225
for more details.
226226
.sp
227+
\fB\-F\fR \fIfeatures\fR,
227228
\fB\-\-features\fR \fIfeatures\fR
228229
.RS 4
229230
Space or comma separated list of features to activate. Features of workspace

Diff for: src/etc/man/cargo-build.1

+1
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,7 @@ selected package.
136136
See \fIthe features documentation\fR <https://doc.rust\-lang.org/cargo/reference/features.html#command\-line\-feature\-options>
137137
for more details.
138138
.sp
139+
\fB\-F\fR \fIfeatures\fR,
139140
\fB\-\-features\fR \fIfeatures\fR
140141
.RS 4
141142
Space or comma separated list of features to activate. Features of workspace

Diff for: src/etc/man/cargo-check.1

+1
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,7 @@ selected package.
141141
See \fIthe features documentation\fR <https://doc.rust\-lang.org/cargo/reference/features.html#command\-line\-feature\-options>
142142
for more details.
143143
.sp
144+
\fB\-F\fR \fIfeatures\fR,
144145
\fB\-\-features\fR \fIfeatures\fR
145146
.RS 4
146147
Space or comma separated list of features to activate. Features of workspace

Diff for: src/etc/man/cargo-doc.1

+1
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,7 @@ selected package.
114114
See \fIthe features documentation\fR <https://doc.rust\-lang.org/cargo/reference/features.html#command\-line\-feature\-options>
115115
for more details.
116116
.sp
117+
\fB\-F\fR \fIfeatures\fR,
117118
\fB\-\-features\fR \fIfeatures\fR
118119
.RS 4
119120
Space or comma separated list of features to activate. Features of workspace

Diff for: src/etc/man/cargo-fix.1

+1
Original file line numberDiff line numberDiff line change
@@ -236,6 +236,7 @@ selected package.
236236
See \fIthe features documentation\fR <https://doc.rust\-lang.org/cargo/reference/features.html#command\-line\-feature\-options>
237237
for more details.
238238
.sp
239+
\fB\-F\fR \fIfeatures\fR,
239240
\fB\-\-features\fR \fIfeatures\fR
240241
.RS 4
241242
Space or comma separated list of features to activate. Features of workspace

Diff for: src/etc/man/cargo-install.1

+1
Original file line numberDiff line numberDiff line change
@@ -209,6 +209,7 @@ selected package.
209209
See \fIthe features documentation\fR <https://doc.rust\-lang.org/cargo/reference/features.html#command\-line\-feature\-options>
210210
for more details.
211211
.sp
212+
\fB\-F\fR \fIfeatures\fR,
212213
\fB\-\-features\fR \fIfeatures\fR
213214
.RS 4
214215
Space or comma separated list of features to activate. Features of workspace

Diff for: src/etc/man/cargo-metadata.1

+1
Original file line numberDiff line numberDiff line change
@@ -322,6 +322,7 @@ selected package.
322322
See \fIthe features documentation\fR <https://doc.rust\-lang.org/cargo/reference/features.html#command\-line\-feature\-options>
323323
for more details.
324324
.sp
325+
\fB\-F\fR \fIfeatures\fR,
325326
\fB\-\-features\fR \fIfeatures\fR
326327
.RS 4
327328
Space or comma separated list of features to activate. Features of workspace

Diff for: src/etc/man/cargo-package.1

+1
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,7 @@ selected package.
173173
See \fIthe features documentation\fR <https://doc.rust\-lang.org/cargo/reference/features.html#command\-line\-feature\-options>
174174
for more details.
175175
.sp
176+
\fB\-F\fR \fIfeatures\fR,
176177
\fB\-\-features\fR \fIfeatures\fR
177178
.RS 4
178179
Space or comma separated list of features to activate. Features of workspace

Diff for: src/etc/man/cargo-publish.1

+1
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,7 @@ selected package.
123123
See \fIthe features documentation\fR <https://doc.rust\-lang.org/cargo/reference/features.html#command\-line\-feature\-options>
124124
for more details.
125125
.sp
126+
\fB\-F\fR \fIfeatures\fR,
126127
\fB\-\-features\fR \fIfeatures\fR
127128
.RS 4
128129
Space or comma separated list of features to activate. Features of workspace

Diff for: src/etc/man/cargo-run.1

+1
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ selected package.
4747
See \fIthe features documentation\fR <https://doc.rust\-lang.org/cargo/reference/features.html#command\-line\-feature\-options>
4848
for more details.
4949
.sp
50+
\fB\-F\fR \fIfeatures\fR,
5051
\fB\-\-features\fR \fIfeatures\fR
5152
.RS 4
5253
Space or comma separated list of features to activate. Features of workspace

Diff for: src/etc/man/cargo-rustc.1

+1
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,7 @@ selected package.
122122
See \fIthe features documentation\fR <https://doc.rust\-lang.org/cargo/reference/features.html#command\-line\-feature\-options>
123123
for more details.
124124
.sp
125+
\fB\-F\fR \fIfeatures\fR,
125126
\fB\-\-features\fR \fIfeatures\fR
126127
.RS 4
127128
Space or comma separated list of features to activate. Features of workspace

Diff for: src/etc/man/cargo-rustdoc.1

+1
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,7 @@ selected package.
133133
See \fIthe features documentation\fR <https://doc.rust\-lang.org/cargo/reference/features.html#command\-line\-feature\-options>
134134
for more details.
135135
.sp
136+
\fB\-F\fR \fIfeatures\fR,
136137
\fB\-\-features\fR \fIfeatures\fR
137138
.RS 4
138139
Space or comma separated list of features to activate. Features of workspace

0 commit comments

Comments
 (0)