diff options
Diffstat (limited to 'src/main.rs')
-rw-r--r-- | src/main.rs | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/src/main.rs b/src/main.rs index ce5f611..898d19e 100644 --- a/src/main.rs +++ b/src/main.rs @@ -4,6 +4,7 @@ mod path; mod poem; use poem::{read::Readable, recite::Reciteable, Poem}; mod compose; +use compose::Environment; /// Starts the main shell loop /// @@ -20,9 +21,9 @@ mod compose; /// repl(prompt, &mut at_prompt); /// } /// ``` -fn repl(prompt: &str, at_prompt: &mut Arc<Mutex<bool>>) { +fn repl(prompt: &str, at_prompt: &mut Arc<Mutex<bool>>, env: &mut Environment) { // Initial path refresh on startup - let mut bins: Vec<String> = path::refresh(); + env.bins = path::refresh(); // Main shell loop loop { @@ -67,7 +68,7 @@ fn repl(prompt: &str, at_prompt: &mut Arc<Mutex<bool>>) { }; // Recite the poem - match poem.recite(&mut bins, None) { + match poem.recite(env, None) { Ok(_) => {} Err(e) => eprintln!("dwvsh: {}", e.to_string().to_lowercase()), } @@ -81,7 +82,7 @@ fn main() { // Compose the environment for dwvsh // TODO: All instances of `env!("HOME")` need to be changed to use env::var // TODO: Will probably need to set $HOME in dwv{profile,login} via passwd - compose::env(); + let mut env = compose::env(); // Set the prompt let prompt = "|> "; @@ -102,5 +103,5 @@ fn main() { }; // Begin evaluating commands - repl(prompt, &mut at_prompt); + repl(prompt, &mut at_prompt, &mut env); } |