aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib.rs')
-rw-r--r--src/lib.rs14
1 files changed, 8 insertions, 6 deletions
diff --git a/src/lib.rs b/src/lib.rs
index 700425a..ef62c44 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -97,7 +97,7 @@ pub struct Session {
history: Vec<HistoryEntry>,
prev_path: BString,
builtins: HashMap<BString, &'static dyn run::BuiltinClone>,
- vars: HashMap<BString, BString>,
+ vars: run::Vars,
funs: HashMap<BString, Block>,
aliases: run::Aliases,
socket_running: Option<export_fun::SocketRunning>,
@@ -125,7 +125,7 @@ impl Session {
history: Vec::new(),
prev_path: b".".into(),
builtins: HashMap::new(),
- vars: HashMap::new(),
+ vars: run::Vars::default(),
funs: HashMap::new(),
aliases: run::Aliases::new(),
socket_running: None,
@@ -171,13 +171,15 @@ fn pretty_cwd_res() -> io::Result<String> {
Ok(s)
}
-fn pretty_cwd() -> String {
- pretty_cwd_res().unwrap_or_else(|_| String::new())
+fn pretty_cwd() -> BString {
+ pretty_cwd_res()
+ .unwrap_or_else(|_| String::new())
+ .into_bytes()
}
impl Session {
fn load_unevaled_prompt(&self) -> BString {
- match self.vars.get(&b"PROMPT"[..]) {
+ match self.vars.lookup(&b"PROMPT"[..]) {
Some(prompt) => prompt.clone(),
None => {
let mut prompt = BString::new();
@@ -485,7 +487,7 @@ pub fn event_loop() {
prev_path: vec![b'.'],
history_visit: 0,
socket_running: None,
- vars: HashMap::new(),
+ vars: run::Vars::default(),
funs: HashMap::new(),
aliases: run::Aliases::new(),
path_cache: Default::default(),