Skip to content

Commit

Permalink
feat(cli): Added 'cls' command to 'watch' mode (rust-lang#474)
Browse files Browse the repository at this point in the history
  • Loading branch information
DeepSpace2 authored and ShakMR committed Aug 18, 2020
1 parent e5d71bb commit 724a7d2
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -143,15 +143,18 @@ fn main() {

fn spawn_watch_shell(failed_exercise_hint: &Arc<Mutex<Option<String>>>) {
let failed_exercise_hint = Arc::clone(failed_exercise_hint);
println!("Type 'hint' to get help");
println!("Type 'hint' to get help or 'clear' to clear the screen");
thread::spawn(move || loop {
let mut input = String::new();
match io::stdin().read_line(&mut input) {
Ok(_) => {
if input.trim().eq("hint") {
let input = input.trim();
if input.eq("hint") {
if let Some(hint) = &*failed_exercise_hint.lock().unwrap() {
println!("{}", hint);
}
} else if input.eq("clear") {
println!("\x1B[2J\x1B[1;1H");
} else {
println!("unknown command: {}", input);
}
Expand Down

0 comments on commit 724a7d2

Please sign in to comment.