Skip to content

Commit 4f2468e

Browse files
authored
feat(cli): Added 'cls' command to 'watch' mode (#474)
1 parent 8f7b5bd commit 4f2468e

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/main.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -143,15 +143,18 @@ fn main() {
143143

144144
fn spawn_watch_shell(failed_exercise_hint: &Arc<Mutex<Option<String>>>) {
145145
let failed_exercise_hint = Arc::clone(failed_exercise_hint);
146-
println!("Type 'hint' to get help");
146+
println!("Type 'hint' to get help or 'clear' to clear the screen");
147147
thread::spawn(move || loop {
148148
let mut input = String::new();
149149
match io::stdin().read_line(&mut input) {
150150
Ok(_) => {
151-
if input.trim().eq("hint") {
151+
let input = input.trim();
152+
if input.eq("hint") {
152153
if let Some(hint) = &*failed_exercise_hint.lock().unwrap() {
153154
println!("{}", hint);
154155
}
156+
} else if input.eq("clear") {
157+
println!("\x1B[2J\x1B[1;1H");
155158
} else {
156159
println!("unknown command: {}", input);
157160
}

0 commit comments

Comments
 (0)