From fa63fd4610fbe4a1d95c4da776e4a1cfa8f8e0b9 Mon Sep 17 00:00:00 2001 From: David Sherret Date: Thu, 15 Jun 2023 13:09:37 -0400 Subject: refactor(flags): move watch flags into subcommand structs (#19516) Moves the watch setting out of the `Flags` struct and into the individual subcommands --- cli/tools/bundle.rs | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) (limited to 'cli/tools/bundle.rs') diff --git a/cli/tools/bundle.rs b/cli/tools/bundle.rs index 1800d03cc..dc944d646 100644 --- a/cli/tools/bundle.rs +++ b/cli/tools/bundle.rs @@ -28,13 +28,12 @@ pub async fn bundle( "Use alternative bundlers like \"deno_emit\", \"esbuild\" or \"rollup\" instead." ); - if flags.watch.is_some() { - let clear_screen = !flags.no_clear_screen; + if let Some(watch_flags) = &bundle_flags.watch { util::file_watcher::watch_func( flags, util::file_watcher::PrintConfig { job_name: "Bundle".to_string(), - clear_screen, + clear_screen: !watch_flags.no_clear_screen, }, move |flags, sender, _changed_paths| { let bundle_flags = bundle_flags.clone(); @@ -44,11 +43,7 @@ pub async fn bundle( .build_from_flags(flags) .await?; let cli_options = factory.cli_options(); - - if let Some(watch_paths) = cli_options.watch_paths() { - let _ = sender.send(watch_paths); - } - + let _ = sender.send(cli_options.watch_paths()); bundle_action(factory, &bundle_flags).await?; Ok(()) -- cgit v1.2.3