diff options
Diffstat (limited to 'ui/src/state.rs')
-rw-r--r-- | ui/src/state.rs | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/ui/src/state.rs b/ui/src/state.rs index 96495f14..36efc1fe 100644 --- a/ui/src/state.rs +++ b/ui/src/state.rs @@ -33,6 +33,7 @@ use melib::backends::{FolderHash, NotifyFn}; use chan::{Receiver, Sender}; use fnv::FnvHashMap; +use std::env; use std::io::Write; use std::result; use std::thread; @@ -471,7 +472,21 @@ impl State { let result = parse_command(&cmd.as_bytes()).to_full_result(); if let Ok(v) = result { - self.rcv_event(UIEvent::Action(v)); + match v { + SetEnv(key, val) => { + env::set_var(key.as_str(), val.as_str()); + } + PrintEnv(key) => { + self.context.replies.push_back(UIEvent::StatusEvent( + StatusEvent::DisplayMessage( + env::var(key.as_str()).unwrap_or_else(|e| e.to_string()), + ), + )); + } + v => { + self.rcv_event(UIEvent::Action(v)); + } + } } } |