@@ -2,7 +2,7 @@ use anyhow::Result;
22use clap:: Parser ;
33use log:: LevelFilter ;
44use regex:: Regex ;
5- use std:: io:: Write ;
5+ use std:: { ffi :: OsString , io:: Write } ;
66
77use rewatch:: { build, cli, cmd, lock, watcher} ;
88
@@ -19,12 +19,24 @@ fn main() -> Result<()> {
1919
2020 let command = args. command . unwrap_or ( cli:: Command :: Build ( args. build_args ) ) ;
2121
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 {
2424 cli:: Command :: Legacy { legacy_args } => {
2525 let code = build:: pass_through_legacy ( legacy_args) ;
2626 std:: process:: exit ( code) ;
2727 }
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+ }
2840 cli:: Command :: CompilerArgs {
2941 path,
3042 dev,
@@ -33,7 +45,7 @@ fn main() -> Result<()> {
3345 } => {
3446 println ! (
3547 "{}" ,
36- build:: get_compiler_args( & path, rescript_version, bsc_path, dev) ?
48+ build:: get_compiler_args( & path, rescript_version. clone ( ) , bsc_path. clone ( ) , * dev) ?
3749 ) ;
3850 std:: process:: exit ( 0 ) ;
3951 }
@@ -92,16 +104,12 @@ fn main() -> Result<()> {
92104
93105 Ok ( ( ) )
94106 }
95- cli:: Command :: CompilerArgs { .. } | cli:: Command :: Legacy { .. } => {
107+ cli:: Command :: CompilerArgs { .. }
108+ | cli:: Command :: Legacy { .. }
109+ | cli:: Command :: Format { .. }
110+ | cli:: Command :: Dump { .. } => {
96111 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+ }
105113 } ,
106114 }
107115}
0 commit comments