diff options
| author | Jonas Maier <> | 2026-05-23 23:34:31 +0200 |
|---|---|---|
| committer | Jonas Maier <> | 2026-05-23 23:34:31 +0200 |
| commit | 7cd15fe67ca0118520dcc4e9e189d513b0375e10 (patch) | |
| tree | eed22bff9dc80eb298323c92acd3b915a803180d /src/lib.rs | |
| parent | a9ea5669915f4ac6b0d9e7d826d1ee341a2e3c80 (diff) | |
| download | pish-7cd15fe67ca0118520dcc4e9e189d513b0375e10.tar.gz | |
prompt evaluation in own module
Diffstat (limited to 'src/lib.rs')
| -rw-r--r-- | src/lib.rs | 37 |
1 files changed, 4 insertions, 33 deletions
@@ -28,14 +28,15 @@ pub mod history; pub mod line; pub mod panic; pub mod parse; +pub mod ps1; pub mod raw; pub mod reload; pub mod run; pub mod rw; pub mod serialization; pub mod syntax_highlighting; -pub mod wait; pub mod variants; +pub mod wait; use raw::*; @@ -182,38 +183,8 @@ fn pretty_cwd() -> BString { } impl Session { - fn load_unevaled_prompt(&self) -> BString { - match self.vars.lookup(&b"PROMPT"[..]) { - Some(prompt) => prompt.into_owned(), - None => { - let mut prompt = BString::new(); - if cfg!(debug_assertions) { - prompt.push_all(b"dev "); - } - prompt.push_all(b"[$CWD_PRETTY]# "); - prompt - } - } - } - - fn prompt(this: Arc<Mutex<Self>>) -> BString { - let mut prompt = this.lock().unwrap().load_unevaled_prompt(); - let mut x = Vec::with_capacity(prompt.len() + 2); - x.push(b'"'); - x.append(&mut prompt); - x.push(b'"'); - let parsed = match crate::parse::ExpString::parse_from_bytes(&x) { - Ok(x) => x, - Err(e) => { - println!("{e:?}"); - return b"PARSE_ERROR$ ".to_vec(); - } - }; - let mut expander = run::Executor::new(this); - let Ok(expanded) = parsed.expand(&mut expander) else { - return b"EXEC_ERROR$ ".to_vec(); - }; - expanded + fn prompt(_this: Arc<Mutex<Self>>) -> BString { + todo!("replace with ps1 module"); } fn prompt_clear(&mut self) { |
