summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJubilee Young <workingjubilee@gmail.com>2019-11-09 23:52:30 -0800
committerJubilee Young <workingjubilee@gmail.com>2019-11-09 00:57:36 -0800
commit83be517e77a87b8de7a24c98f38ae10412d02aec (patch)
tree8f10af11cc1f0834aaf6cdc4a027ece65402036d
parent79a569422c8309cfc9e4aed25bf4ab3b3859996b (diff)
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.
-rw-r--r--src/main.rs3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/main.rs b/src/main.rs
index 78ed060..857d34e 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -80,6 +80,9 @@ fn main() {
}
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();
}