@@ -2,7 +2,7 @@ use anyhow::Result;
2
2
use clap:: Parser ;
3
3
use log:: LevelFilter ;
4
4
use regex:: Regex ;
5
- use std:: io:: Write ;
5
+ use std:: { ffi :: OsString , io:: Write } ;
6
6
7
7
use rewatch:: { build, cli, cmd, lock, watcher} ;
8
8
@@ -19,12 +19,24 @@ fn main() -> Result<()> {
19
19
20
20
let command = args. command . unwrap_or ( cli:: Command :: Build ( args. build_args ) ) ;
21
21
22
- // handle legacy and compiler args early, because we don't need a lock for them
23
- match command {
22
+ // handle those commands early, because we don't need a lock for them
23
+ match & command {
24
24
cli:: Command :: Legacy { legacy_args } => {
25
25
let code = build:: pass_through_legacy ( legacy_args) ;
26
26
std:: process:: exit ( code) ;
27
27
}
28
+ cli:: Command :: Format { format_args } => {
29
+ let mut args: Vec < OsString > = vec ! [ "format" . into( ) ] ;
30
+ args. append ( & mut format_args. clone ( ) ) ;
31
+ let code = build:: pass_through_legacy ( args. as_slice ( ) ) ;
32
+ std:: process:: exit ( code) ;
33
+ }
34
+ cli:: Command :: Dump { dump_args } => {
35
+ let mut args: Vec < OsString > = vec ! [ "dump" . into( ) ] ;
36
+ args. append ( & mut dump_args. clone ( ) ) ;
37
+ let code = build:: pass_through_legacy ( args. as_slice ( ) ) ;
38
+ std:: process:: exit ( code) ;
39
+ }
28
40
cli:: Command :: CompilerArgs {
29
41
path,
30
42
dev,
@@ -33,7 +45,7 @@ fn main() -> Result<()> {
33
45
} => {
34
46
println ! (
35
47
"{}" ,
36
- build:: get_compiler_args( & path, rescript_version, bsc_path, dev) ?
48
+ build:: get_compiler_args( & path, rescript_version. clone ( ) , bsc_path. clone ( ) , * dev) ?
37
49
) ;
38
50
std:: process:: exit ( 0 ) ;
39
51
}
@@ -92,16 +104,12 @@ fn main() -> Result<()> {
92
104
93
105
Ok ( ( ) )
94
106
}
95
- cli:: Command :: CompilerArgs { .. } | cli:: Command :: Legacy { .. } => {
107
+ cli:: Command :: CompilerArgs { .. }
108
+ | cli:: Command :: Legacy { .. }
109
+ | cli:: Command :: Format { .. }
110
+ | cli:: Command :: Dump { .. } => {
96
111
unreachable ! ( "command already handled" )
97
- } // Command::Format => {
98
- // let code = build::pass_through_legacy(vec!["format".to_owned()]);
99
- // std::process::exit(code);
100
- // }
101
- // Command::Dump => {
102
- // let code = build::pass_through_legacy(vec!["dump".to_owned()]);
103
- // std::process::exit(code);
104
- // }
112
+ }
105
113
} ,
106
114
}
107
115
}
0 commit comments