summaryrefslogtreecommitdiffstats
path: root/src/main.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/main.rs')
-rw-r--r--src/main.rs29
1 files changed, 19 insertions, 10 deletions
diff --git a/src/main.rs b/src/main.rs
index 04d58eb..75c2d46 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -1,9 +1,10 @@
-mod recite;
-use recite::path::prefresh;
-use recite::Poem;
use std::io::{self, Write};
use std::path::Path;
use std::sync::{Arc, Mutex};
+mod path;
+use path::prefresh;
+mod poem;
+use poem::{read::Readable, recite::Reciteable, Poem};
/// Starts the main shell loop
///
@@ -57,15 +58,23 @@ fn repl(path: &Vec<&Path>, prompt: &str, at_prompt: &mut Arc<Mutex<bool>>) {
// Not at the prompt
*at_prompt.lock().unwrap() = false;
- // Parse a poem
+ // Parse the poem
let poem = Poem::read(poetry);
- match poem {
- Some(poem) => match poem.recite(path, &mut bins) {
- Ok(_) => {}
- Err(e) => eprintln!("dwvsh: {}", e.to_string().to_lowercase()),
- },
- None => {}
+ let poem = match poem {
+ Ok(poem) => poem,
+ Err(e) => {
+ eprintln!("dwvsh: {}", e.to_string().to_lowercase());
+ continue;
+ }
};
+
+ // println!("{:?}", poem);
+
+ // Recite the poem
+ match poem.recite(path, &mut bins, None) {
+ Ok(_) => {}
+ Err(e) => eprintln!("dwvsh: {}", e.to_string().to_lowercase()),
+ }
}
}