summaryrefslogtreecommitdiff
path: root/cli/util/file_watcher.rs
diff options
context:
space:
mode:
Diffstat (limited to 'cli/util/file_watcher.rs')
-rw-r--r--cli/util/file_watcher.rs21
1 files changed, 11 insertions, 10 deletions
diff --git a/cli/util/file_watcher.rs b/cli/util/file_watcher.rs
index 21ea95e06..eb3fb8c60 100644
--- a/cli/util/file_watcher.rs
+++ b/cli/util/file_watcher.rs
@@ -127,19 +127,12 @@ impl PrintConfig {
}
}
-fn create_print_after_restart_fn(
- banner: &'static str,
- clear_screen: bool,
-) -> impl Fn() {
+fn create_print_after_restart_fn(clear_screen: bool) -> impl Fn() {
move || {
#[allow(clippy::print_stderr)]
if clear_screen && std::io::stderr().is_terminal() {
eprint!("{}", CLEAR_SCREEN);
}
- info!(
- "{} File change detected! Restarting!",
- colors::intense_blue(banner),
- );
}
}
@@ -187,7 +180,15 @@ impl WatcherCommunicator {
}
pub fn print(&self, msg: String) {
- log::info!("{} {}", self.banner, msg);
+ log::info!("{} {}", self.banner, colors::gray(msg));
+ }
+
+ pub fn show_path_changed(&self, changed_paths: Option<Vec<PathBuf>>) {
+ if let Some(paths) = changed_paths {
+ self.print(
+ format!("Restarting! File change detected: {:?}", paths[0]).to_string(),
+ )
+ }
}
}
@@ -263,7 +264,7 @@ where
clear_screen,
} = print_config;
- let print_after_restart = create_print_after_restart_fn(banner, clear_screen);
+ let print_after_restart = create_print_after_restart_fn(clear_screen);
let watcher_communicator = Arc::new(WatcherCommunicator {
paths_to_watch_tx: paths_to_watch_tx.clone(),
changed_paths_rx: changed_paths_rx.resubscribe(),