File tree 2 files changed +14
-10
lines changed
2 files changed +14
-10
lines changed Original file line number Diff line number Diff line change @@ -2,12 +2,12 @@ use std::env;
2
2
use std:: process;
3
3
4
4
mod build;
5
- mod cargo;
6
5
mod clean;
7
6
mod clone_gcc;
8
7
mod config;
9
8
mod info;
10
9
mod prepare;
10
+ mod rust_tools;
11
11
mod rustc_info;
12
12
mod test;
13
13
mod utils;
@@ -75,7 +75,7 @@ fn main() {
75
75
} ;
76
76
77
77
if let Err ( e) = match command {
78
- Command :: Cargo => cargo :: run ( ) ,
78
+ Command :: Cargo => rust_tools :: run_cargo ( ) ,
79
79
Command :: Clean => clean:: run ( ) ,
80
80
Command :: Prepare => prepare:: run ( ) ,
81
81
Command :: Build => build:: run ( ) ,
Original file line number Diff line number Diff line change @@ -8,32 +8,36 @@ use std::collections::HashMap;
8
8
use std:: ffi:: OsStr ;
9
9
use std:: path:: PathBuf ;
10
10
11
- fn args ( ) -> Result < Option < Vec < String > > , String > {
11
+ fn args ( command : & str ) -> Result < Option < Vec < String > > , String > {
12
12
// We skip the binary and the "cargo" option.
13
13
if let Some ( "--help" ) = std:: env:: args ( ) . skip ( 2 ) . next ( ) . as_deref ( ) {
14
- usage ( ) ;
14
+ usage ( command ) ;
15
15
return Ok ( None ) ;
16
16
}
17
17
let args = std:: env:: args ( ) . skip ( 2 ) . collect :: < Vec < _ > > ( ) ;
18
18
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
+ ) ) ;
20
23
}
21
24
Ok ( Some ( args) )
22
25
}
23
26
24
- fn usage ( ) {
27
+ fn usage ( command : & str ) {
25
28
println ! (
26
29
r#"
27
- `cargo ` command help:
30
+ `{} ` command help:
28
31
29
32
[args] : Arguments to be passed to the cargo command
30
33
--help : Show this help
31
- "#
34
+ "# ,
35
+ command,
32
36
)
33
37
}
34
38
35
- pub fn run ( ) -> Result < ( ) , String > {
36
- let args = match args ( ) ? {
39
+ pub fn run_cargo ( ) -> Result < ( ) , String > {
40
+ let args = match args ( "cargo" ) ? {
37
41
Some ( a) => a,
38
42
None => return Ok ( ( ) ) ,
39
43
} ;
You can’t perform that action at this time.
0 commit comments