File tree Expand file tree Collapse file tree 2 files changed +26
-2
lines changed Expand file tree Collapse file tree 2 files changed +26
-2
lines changed Original file line number Diff line number Diff line change @@ -107,6 +107,10 @@ pub struct BuildArgs {
107107
108108 #[ command( flatten) ]
109109 pub snapshot_output : SnapshotOutputArg ,
110+
111+ /// Watch mode (deprecated, use `rescript watch` instead)
112+ #[ arg( short, default_value_t = false , num_args = 0 ..=1 ) ]
113+ pub watch : bool ,
110114}
111115
112116#[ derive( Args , Clone , Debug ) ]
@@ -130,6 +134,19 @@ pub struct WatchArgs {
130134 pub snapshot_output : SnapshotOutputArg ,
131135}
132136
137+ impl From < BuildArgs > for WatchArgs {
138+ fn from ( build_args : BuildArgs ) -> Self {
139+ Self {
140+ folder : build_args. folder ,
141+ filter : build_args. filter ,
142+ after_build : build_args. after_build ,
143+ create_sourcedirs : build_args. create_sourcedirs ,
144+ dev : build_args. dev ,
145+ snapshot_output : build_args. snapshot_output ,
146+ }
147+ }
148+ }
149+
133150#[ derive( Subcommand , Clone , Debug ) ]
134151pub enum Command {
135152 /// Build the project
Original file line number Diff line number Diff line change @@ -17,13 +17,20 @@ fn main() -> Result<()> {
1717 . target ( env_logger:: fmt:: Target :: Stdout )
1818 . init ( ) ;
1919
20- let command = args. command . unwrap_or ( cli:: Command :: Build ( args. build_args ) ) ;
20+ let mut command = args. command . unwrap_or ( cli:: Command :: Build ( args. build_args ) ) ;
21+
22+ if let cli:: Command :: Build ( build_args) = & command {
23+ if build_args. watch {
24+ log:: warn!( "`rescript build -w` is deprecated. Please use `rescript watch` instead." ) ;
25+ command = cli:: Command :: Watch ( build_args. clone ( ) . into ( ) ) ;
26+ }
27+ }
2128
2229 // The 'normal run' mode will show the 'pretty' formatted progress. But if we turn off the log
2330 // level, we should never show that.
2431 let show_progress = log_level_filter == LevelFilter :: Info ;
2532
26- match command. clone ( ) {
33+ match command {
2734 cli:: Command :: CompilerArgs { path, dev } => {
2835 println ! ( "{}" , build:: get_compiler_args( Path :: new( & path) , * dev) ?) ;
2936 std:: process:: exit ( 0 ) ;
You can’t perform that action at this time.
0 commit comments