summaryrefslogtreecommitdiff
path: root/src/watch.rs
diff options
context:
space:
mode:
authorNahor <nahor.j+github@gmail.com>2024-10-02 13:40:32 -0700
committerNahor <nahor.j+github@gmail.com>2024-10-02 13:40:32 -0700
commitc52867eb8bf69f67e702b87dd2bf12125aa7ab12 (patch)
tree8bd8d22b1de936b279063e0a43c1c740708a7c15 /src/watch.rs
parent26fd97a209d936755aa653ee0110d17d27e47306 (diff)
Add command to check all the exercises
This allows for skipping repeating "next" when multiple exercises are done at once, or when earlier exercises have been updated/changed (and thus must be redone) while still working of the whole set (i.e. the final check_all is not yet available to flag those undone exercises)
Diffstat (limited to 'src/watch.rs')
-rw-r--r--src/watch.rs7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/watch.rs b/src/watch.rs
index 35533b0..b984675 100644
--- a/src/watch.rs
+++ b/src/watch.rs
@@ -103,6 +103,13 @@ fn run_watch(
WatchEvent::Input(InputEvent::Run) => watch_state.run_current_exercise(&mut stdout)?,
WatchEvent::Input(InputEvent::Hint) => watch_state.show_hint(&mut stdout)?,
WatchEvent::Input(InputEvent::List) => return Ok(WatchExit::List),
+ WatchEvent::Input(InputEvent::CheckAll) => match watch_state
+ .check_all_exercises(&mut stdout)?
+ {
+ ExercisesProgress::AllDone => break,
+ ExercisesProgress::NewPending => watch_state.run_current_exercise(&mut stdout)?,
+ ExercisesProgress::CurrentPending => (),
+ },
WatchEvent::Input(InputEvent::Reset) => watch_state.reset_exercise(&mut stdout)?,
WatchEvent::Input(InputEvent::Quit) => {
stdout.write_all(QUIT_MSG)?;