File tree Expand file tree Collapse file tree 2 files changed +14
-10
lines changed Expand file tree Collapse file tree 2 files changed +14
-10
lines changed Original file line number Diff line number Diff line change @@ -2,12 +2,12 @@ use std::env;
22use std:: process;
33
44mod build;
5- mod cargo;
65mod clean;
76mod clone_gcc;
87mod config;
98mod info;
109mod prepare;
10+ mod rust_tools;
1111mod rustc_info;
1212mod test;
1313mod utils;
@@ -75,7 +75,7 @@ fn main() {
7575 } ;
7676
7777 if let Err ( e) = match command {
78- Command :: Cargo => cargo :: run ( ) ,
78+ Command :: Cargo => rust_tools :: run_cargo ( ) ,
7979 Command :: Clean => clean:: run ( ) ,
8080 Command :: Prepare => prepare:: run ( ) ,
8181 Command :: Build => build:: run ( ) ,
Original file line number Diff line number Diff line change @@ -8,32 +8,36 @@ use std::collections::HashMap;
88use std:: ffi:: OsStr ;
99use std:: path:: PathBuf ;
1010
11- fn args ( ) -> Result < Option < Vec < String > > , String > {
11+ fn args ( command : & str ) -> Result < Option < Vec < String > > , String > {
1212 // We skip the binary and the "cargo" option.
1313 if let Some ( "--help" ) = std:: env:: args ( ) . skip ( 2 ) . next ( ) . as_deref ( ) {
14- usage ( ) ;
14+ usage ( command ) ;
1515 return Ok ( None ) ;
1616 }
1717 let args = std:: env:: args ( ) . skip ( 2 ) . collect :: < Vec < _ > > ( ) ;
1818 if args. is_empty ( ) {
19- return Err ( "Expected at least one argument for `cargo` subcommand, found none" . to_string ( ) ) ;
19+ return Err ( format ! (
20+ "Expected at least one argument for `{}` subcommand, found none" ,
21+ command
22+ ) ) ;
2023 }
2124 Ok ( Some ( args) )
2225}
2326
24- fn usage ( ) {
27+ fn usage ( command : & str ) {
2528 println ! (
2629 r#"
27- `cargo ` command help:
30+ `{} ` command help:
2831
2932 [args] : Arguments to be passed to the cargo command
3033 --help : Show this help
31- "#
34+ "# ,
35+ command,
3236 )
3337}
3438
35- pub fn run ( ) -> Result < ( ) , String > {
36- let args = match args ( ) ? {
39+ pub fn run_cargo ( ) -> Result < ( ) , String > {
40+ let args = match args ( "cargo" ) ? {
3741 Some ( a) => a,
3842 None => return Ok ( ( ) ) ,
3943 } ;
You can’t perform that action at this time.
0 commit comments