Skip to content

Commit

Permalink
Terminal is now cleared when the first file change has been detected.…
Browse files Browse the repository at this point in the history
… I also added the "DETECTED CHANGES:" header printout.
  • Loading branch information
breki committed Apr 26, 2022
1 parent e885d9a commit 8012349
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions tcr/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,17 @@ fn collect_watch_events(
&matching_files,
) {
Some(event_data) => {
if collected_events.len() == 0 {
// clear the terminal
print!("\x1B[2J");
println!("DETECTED CHANGES:");
tx_watch_events_starter.send(1).unwrap();
}

if !collected_events.contains(&event_data) {
println!("{}", event_data);
}

if collected_events.len() == 0 {
tx_watch_events_starter.send(1).unwrap();
}
collected_events.insert(event_data);
}
None => (),
Expand All @@ -64,9 +68,6 @@ fn run_tests_on_files_update(
loop {
match rx_watch_events_starter.recv() {
Ok(1) => {
// clear the terminal
// print!("\x1B[2J");

thread::sleep(delay);

{
Expand Down

0 comments on commit 8012349

Please sign in to comment.