watch: clears terminal before entering loop

If someone is sliding in and out of "watch" mode, it can make it hard
to tell which error messages are still relevant. This patch resolves
that by clearing the terminal entirely before entering watch's loop.
This commit is contained in:
Jubilee Young 2019-11-09 23:52:30 -08:00
parent 79a569422c
commit 83be517e77
1 changed files with 3 additions and 0 deletions

View File

@ -80,6 +80,9 @@ fn main() {
} }
if matches.subcommand_matches("watch").is_some() { if matches.subcommand_matches("watch").is_some() {
/* Clears the terminal with an ANSI escape code.
Works in UNIX and newer Windows terminals. */
println!("\x1Bc");
watch(&exercises).unwrap(); watch(&exercises).unwrap();
} }