When dealing with the list of all possible subcommands, deal with them in the same order to ease comparing the sections of code in order. I chose the order that appears in the help text, because that is most likely to have been ordered with specific reasoning.

This commit is contained in:
Nathan Stocks 2017-03-30 20:58:07 -06:00
parent e1b0027b51
commit 8ad5c95e52

View File

@ -157,11 +157,11 @@ Arguments:
if let Some(subcommand) = subcommand {
if subcommand == "build" ||
subcommand == "dist" ||
subcommand == "doc" ||
subcommand == "test" ||
subcommand == "bench" ||
subcommand == "clean" {
subcommand == "doc" ||
subcommand == "clean" ||
subcommand == "dist" {
println!("Available invocations:");
if args.iter().any(|a| a == "-v") {
let flags = Flags::parse(&["build".to_string()]);
@ -219,10 +219,6 @@ To learn more about a subcommand, run `./x.py <subcommand> -h`
m = parse(&opts);
Subcommand::Build { paths: remaining_as_path(&m) }
}
"doc" => {
m = parse(&opts);
Subcommand::Doc { paths: remaining_as_path(&m) }
}
"test" => {
opts.optmulti("", "test-args", "extra arguments", "ARGS");
m = parse(&opts);
@ -239,6 +235,10 @@ To learn more about a subcommand, run `./x.py <subcommand> -h`
test_args: m.opt_strs("test-args"),
}
}
"doc" => {
m = parse(&opts);
Subcommand::Doc { paths: remaining_as_path(&m) }
}
"clean" => {
m = parse(&opts);
if m.free.len() > 0 {