Skip to content

Commit b83853d

Browse files
committedMay 4, 2020
Add command aliases from Cargo to x.py commands
1 parent d626e4d commit b83853d

File tree

1 file changed

+17
-13
lines changed

1 file changed

+17
-13
lines changed
 

‎src/bootstrap/flags.rs

+17-13
Original file line numberDiff line numberDiff line change
@@ -106,18 +106,18 @@ impl Flags {
106106
Usage: x.py <subcommand> [options] [<paths>...]
107107
108108
Subcommands:
109-
build Compile either the compiler or libraries
110-
check Compile either the compiler or libraries, using cargo check
109+
build, b Compile either the compiler or libraries
110+
check, c Compile either the compiler or libraries, using cargo check
111111
clippy Run clippy (uses rustup/cargo-installed clippy binary)
112112
fix Run cargo fix
113113
fmt Run rustfmt
114-
test Build and run some test suites
114+
test, t Build and run some test suites
115115
bench Build and run some benchmarks
116116
doc Build documentation
117117
clean Clean out build directories
118118
dist Build distribution artifacts
119119
install Install distribution artifacts
120-
run Run tools contained in this repository
120+
run, r Run tools contained in this repository
121121
122122
To learn more about a subcommand, run `./x.py <subcommand> -h`",
123123
);
@@ -184,17 +184,21 @@ To learn more about a subcommand, run `./x.py <subcommand> -h`",
184184
// there on out.
185185
let subcommand = args.iter().find(|&s| {
186186
(s == "build")
187+
|| (s == "b")
187188
|| (s == "check")
189+
|| (s == "c")
188190
|| (s == "clippy")
189191
|| (s == "fix")
190192
|| (s == "fmt")
191193
|| (s == "test")
194+
|| (s == "t")
192195
|| (s == "bench")
193196
|| (s == "doc")
194197
|| (s == "clean")
195198
|| (s == "dist")
196199
|| (s == "install")
197200
|| (s == "run")
201+
|| (s == "r")
198202
});
199203
let subcommand = match subcommand {
200204
Some(s) => s,
@@ -210,7 +214,7 @@ To learn more about a subcommand, run `./x.py <subcommand> -h`",
210214

211215
// Some subcommands get extra options
212216
match subcommand.as_str() {
213-
"test" => {
217+
"test" | "t" => {
214218
opts.optflag("", "no-fail-fast", "Run all tests regardless of failure");
215219
opts.optmulti("", "test-args", "extra arguments", "ARGS");
216220
opts.optmulti(
@@ -285,7 +289,7 @@ To learn more about a subcommand, run `./x.py <subcommand> -h`",
285289
}
286290
// Extra help text for some commands
287291
match subcommand.as_str() {
288-
"build" => {
292+
"build" | "b" => {
289293
subcommand_help.push_str(
290294
"\n
291295
Arguments:
@@ -312,7 +316,7 @@ Arguments:
312316
Once this is done, build/$ARCH/stage1 contains a usable compiler.",
313317
);
314318
}
315-
"check" => {
319+
"check" | "c" => {
316320
subcommand_help.push_str(
317321
"\n
318322
Arguments:
@@ -362,7 +366,7 @@ Arguments:
362366
./x.py fmt --check",
363367
);
364368
}
365-
"test" => {
369+
"test" | "t" => {
366370
subcommand_help.push_str(
367371
"\n
368372
Arguments:
@@ -407,7 +411,7 @@ Arguments:
407411
./x.py doc --stage 1",
408412
);
409413
}
410-
"run" => {
414+
"run" | "r" => {
411415
subcommand_help.push_str(
412416
"\n
413417
Arguments:
@@ -453,11 +457,11 @@ Arguments:
453457
}
454458

455459
let cmd = match subcommand.as_str() {
456-
"build" => Subcommand::Build { paths },
457-
"check" => Subcommand::Check { paths },
460+
"build" | "b" => Subcommand::Build { paths },
461+
"check" | "c" => Subcommand::Check { paths },
458462
"clippy" => Subcommand::Clippy { paths },
459463
"fix" => Subcommand::Fix { paths },
460-
"test" => Subcommand::Test {
464+
"test" | "t" => Subcommand::Test {
461465
paths,
462466
bless: matches.opt_present("bless"),
463467
compare_mode: matches.opt_str("compare-mode"),
@@ -487,7 +491,7 @@ Arguments:
487491
"fmt" => Subcommand::Format { check: matches.opt_present("check") },
488492
"dist" => Subcommand::Dist { paths },
489493
"install" => Subcommand::Install { paths },
490-
"run" => {
494+
"run" | "r" => {
491495
if paths.is_empty() {
492496
println!("\nrun requires at least a path!\n");
493497
usage(1, &opts, &subcommand_help, &extra_help);

0 commit comments

Comments
 (0)
Please sign in to comment.