Skip to content

Commit 821fabd

Browse files
Remove available paths list.
Ideally, we'd have feature parity, but I worry that this feature doesn't carry it's weight enough to make it worth reimplementing. The new more-or-less pathless system also makes it rather difficult to implement this feature.
1 parent 568f4c7 commit 821fabd

File tree

1 file changed

+27
-30
lines changed

1 file changed

+27
-30
lines changed

src/bootstrap/flags.rs

Lines changed: 27 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,6 @@ use std::process;
2020

2121
use getopts::Options;
2222

23-
use Build;
24-
use config::Config;
25-
use metadata;
26-
2723
use cache::{Interned, INTERNER};
2824

2925
/// Deserialized version of all flags for this compile.
@@ -69,7 +65,6 @@ pub enum Subcommand {
6965

7066
impl Flags {
7167
pub fn parse(args: &[String]) -> Flags {
72-
let mut extra_help = String::new();
7368
let mut subcommand_help = format!("\
7469
Usage: x.py <subcommand> [options] [<paths>...]
7570
@@ -100,11 +95,8 @@ To learn more about a subcommand, run `./x.py <subcommand> -h`");
10095
opts.optflag("h", "help", "print this help message");
10196

10297
// fn usage()
103-
let usage = |exit_code: i32, opts: &Options, subcommand_help: &str, extra_help: &str| -> ! {
98+
let usage = |exit_code: i32, opts: &Options, subcommand_help: &str| -> ! {
10499
println!("{}", opts.usage(subcommand_help));
105-
if !extra_help.is_empty() {
106-
println!("{}", extra_help);
107-
}
108100
process::exit(exit_code);
109101
};
110102

@@ -144,7 +136,7 @@ To learn more about a subcommand, run `./x.py <subcommand> -h`");
144136
let matches = opts.parse(&args[..]).unwrap_or_else(|e| {
145137
// Invalid argument/option format
146138
println!("\n{}\n", e);
147-
usage(1, &opts, &subcommand_help, &extra_help);
139+
usage(1, &opts, &subcommand_help);
148140
});
149141
// Extra sanity check to make sure we didn't hit this crazy corner case:
150142
//
@@ -240,27 +232,32 @@ Arguments:
240232
}
241233
});
242234

243-
// All subcommands can have an optional "Available paths" section
244-
if matches.opt_present("verbose") {
245-
let flags = Flags::parse(&["build".to_string()]);
246-
let mut config = Config::parse(&flags.build, cfg_file.clone());
247-
config.build = flags.build.clone();
248-
let mut build = Build::new(flags, config);
249-
metadata::build(&mut build);
250-
251-
// FIXME: How should this happen now? Not super clear...
252-
// let maybe_rules_help = step::build_rules(&build).get_help(subcommand);
253-
// if maybe_rules_help.is_some() {
254-
// extra_help.push_str(maybe_rules_help.unwrap().as_str());
255-
// }
256-
} else {
257-
extra_help.push_str(format!("Run `./x.py {} -h -v` to see a list of available paths.",
258-
subcommand).as_str());
259-
}
235+
// FIXME: The rustbuild rewrite does not make an available paths
236+
// sections simple or easy to implement. I'm not sure how useful it is
237+
// to have so perhaps we shouldn't attempt to reimplement it due to the
238+
// difficulties imposed by such a move.
239+
//
240+
//// All subcommands can have an optional "Available paths" section
241+
//if matches.opt_present("verbose") {
242+
// let flags = Flags::parse(&["build".to_string()]);
243+
// let mut config = Config::parse(&flags.build, cfg_file.clone());
244+
// config.build = flags.build.clone();
245+
// let mut build = Build::new(flags, config);
246+
// metadata::build(&mut build);
247+
248+
// // FIXME: How should this happen now? Not super clear...
249+
// // let maybe_rules_help = step::build_rules(&build).get_help(subcommand);
250+
// // if maybe_rules_help.is_some() {
251+
// // extra_help.push_str(maybe_rules_help.unwrap().as_str());
252+
// // }
253+
//} else {
254+
// extra_help.push_str(format!("Run `./x.py {} -h -v` to see a list of available paths.",
255+
// subcommand).as_str());
256+
//}
260257

261258
// User passed in -h/--help?
262259
if matches.opt_present("help") {
263-
usage(0, &opts, &subcommand_help, &extra_help);
260+
usage(0, &opts, &subcommand_help);
264261
}
265262

266263
let cmd = match subcommand.as_str() {
@@ -286,7 +283,7 @@ Arguments:
286283
"clean" => {
287284
if paths.len() > 0 {
288285
println!("\nclean takes no arguments\n");
289-
usage(1, &opts, &subcommand_help, &extra_help);
286+
usage(1, &opts, &subcommand_help);
290287
}
291288
Subcommand::Clean
292289
}
@@ -301,7 +298,7 @@ Arguments:
301298
}
302299
}
303300
_ => {
304-
usage(1, &opts, &subcommand_help, &extra_help);
301+
usage(1, &opts, &subcommand_help);
305302
}
306303
};
307304

0 commit comments

Comments
 (0)