@@ -20,10 +20,6 @@ use std::process;
20
20
21
21
use getopts:: Options ;
22
22
23
- use Build ;
24
- use config:: Config ;
25
- use metadata;
26
-
27
23
use cache:: { Interned , INTERNER } ;
28
24
29
25
/// Deserialized version of all flags for this compile.
@@ -69,7 +65,6 @@ pub enum Subcommand {
69
65
70
66
impl Flags {
71
67
pub fn parse ( args : & [ String ] ) -> Flags {
72
- let mut extra_help = String :: new ( ) ;
73
68
let mut subcommand_help = format ! ( "\
74
69
Usage: x.py <subcommand> [options] [<paths>...]
75
70
@@ -100,11 +95,8 @@ To learn more about a subcommand, run `./x.py <subcommand> -h`");
100
95
opts. optflag ( "h" , "help" , "print this help message" ) ;
101
96
102
97
// 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 | -> ! {
104
99
println ! ( "{}" , opts. usage( subcommand_help) ) ;
105
- if !extra_help. is_empty ( ) {
106
- println ! ( "{}" , extra_help) ;
107
- }
108
100
process:: exit ( exit_code) ;
109
101
} ;
110
102
@@ -144,7 +136,7 @@ To learn more about a subcommand, run `./x.py <subcommand> -h`");
144
136
let matches = opts. parse ( & args[ ..] ) . unwrap_or_else ( |e| {
145
137
// Invalid argument/option format
146
138
println ! ( "\n {}\n " , e) ;
147
- usage ( 1 , & opts, & subcommand_help, & extra_help ) ;
139
+ usage ( 1 , & opts, & subcommand_help) ;
148
140
} ) ;
149
141
// Extra sanity check to make sure we didn't hit this crazy corner case:
150
142
//
@@ -240,27 +232,32 @@ Arguments:
240
232
}
241
233
} ) ;
242
234
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
+ //}
260
257
261
258
// User passed in -h/--help?
262
259
if matches. opt_present ( "help" ) {
263
- usage ( 0 , & opts, & subcommand_help, & extra_help ) ;
260
+ usage ( 0 , & opts, & subcommand_help) ;
264
261
}
265
262
266
263
let cmd = match subcommand. as_str ( ) {
@@ -286,7 +283,7 @@ Arguments:
286
283
"clean" => {
287
284
if paths. len ( ) > 0 {
288
285
println ! ( "\n clean takes no arguments\n " ) ;
289
- usage ( 1 , & opts, & subcommand_help, & extra_help ) ;
286
+ usage ( 1 , & opts, & subcommand_help) ;
290
287
}
291
288
Subcommand :: Clean
292
289
}
@@ -301,7 +298,7 @@ Arguments:
301
298
}
302
299
}
303
300
_ => {
304
- usage ( 1 , & opts, & subcommand_help, & extra_help ) ;
301
+ usage ( 1 , & opts, & subcommand_help) ;
305
302
}
306
303
} ;
307
304
0 commit comments