diff options
| author | diannasoriel <mokou@fastmail.com> | 2021-09-24 13:05:04 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-09-24 13:05:04 +0200 |
| commit | ae56cba9c8e5184d557e5ce4fc147bb359ada0d2 (patch) | |
| tree | 7cb6c673af9492baf1c61c5616dd93e935958e06 | |
| parent | 24762434ffa8f5509081ae22460e8569a83d15a6 (diff) | |
| parent | 3352b5a4d380df65763b4e64fc9e8938a3adfd80 (diff) | |
Merge pull request #846 from rust-lang/feat/add-more-watch-commands
feat: add more watch commands
| -rw-r--r-- | src/main.rs | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/src/main.rs b/src/main.rs index 1e34347..d01a827 100644 --- a/src/main.rs +++ b/src/main.rs @@ -264,7 +264,7 @@ 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' or open the corresponding README.md file to get help or type 'clear' to clear the screen."); + println!("Welcome to watch mode! You can type 'help' to get an overview of the commands you can use here."); thread::spawn(move || loop { let mut input = String::new(); match io::stdin().read_line(&mut input) { @@ -276,6 +276,18 @@ fn spawn_watch_shell(failed_exercise_hint: &Arc<Mutex<Option<String>>>) { } } else if input.eq("clear") { println!("\x1B[2J\x1B[1;1H"); + } else if input.eq("quit") { + println!("Bye!"); + std::process::exit(0); + } else if input.eq("help") { + println!("Commands available to you in watch mode:"); + println!(" hint - prints the current exercise's hint"); + println!(" clear - clears the screen"); + println!(" quit - quits watch mode"); + println!(" help - displays this help message"); + println!(); + println!("Watch mode automatically re-evaluates the current exercise"); + println!("when you edit a file's contents.") } else { println!("unknown command: {}", input); } |
