summaryrefslogtreecommitdiff
path: root/src/watch.rs
diff options
context:
space:
mode:
authormo8it <mo8it@proton.me>2024-04-11 02:51:02 +0200
committermo8it <mo8it@proton.me>2024-04-11 02:51:02 +0200
commitfa1f239a702eb2c0b7e0115e986481156961bbc8 (patch)
tree08ac7c8638546f80ac650474dfe4126103a15e54 /src/watch.rs
parent4bb6bda9f6416e30233342e73fc9a8486faa3f98 (diff)
Remove "I AM NOT DONE" and the verify mode and add AppState
Diffstat (limited to 'src/watch.rs')
-rw-r--r--src/watch.rs10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/watch.rs b/src/watch.rs
index b29169b..929275f 100644
--- a/src/watch.rs
+++ b/src/watch.rs
@@ -15,7 +15,7 @@ mod debounce_event;
mod state;
mod terminal_event;
-use crate::{exercise::Exercise, state_file::StateFile};
+use crate::app_state::AppState;
use self::{
debounce_event::DebounceEventHandler,
@@ -39,23 +39,23 @@ pub enum WatchExit {
List,
}
-pub fn watch(state_file: &mut StateFile, exercises: &'static [Exercise]) -> Result<WatchExit> {
+pub fn watch(app_state: &mut AppState) -> Result<WatchExit> {
let (tx, rx) = channel();
let mut debouncer = new_debouncer(
Duration::from_secs(1),
DebounceEventHandler {
tx: tx.clone(),
- exercises,
+ exercises: app_state.exercises(),
},
)?;
debouncer
.watcher()
.watch(Path::new("exercises"), RecursiveMode::Recursive)?;
- let mut watch_state = WatchState::new(state_file, exercises);
+ let mut watch_state = WatchState::new(app_state);
// TODO: bool
- watch_state.run_exercise()?;
+ watch_state.run_current_exercise()?;
watch_state.render()?;
thread::spawn(move || terminal_event_handler(tx));