Implemented cmd runtime expansion for the prompt

This commit is contained in:
2025-03-09 03:51:49 -04:00
parent 58abe3bc3d
commit 9b805c542c
6 changed files with 84 additions and 48 deletions

View File

@@ -28,6 +28,7 @@ fn init_rl<'a>(shenv: &'a mut ShEnv) -> Editor<SynHelper<'a>, DefaultHistory> {
pub fn read_line(shenv: &mut ShEnv) -> ShResult<String> {
log!(TRACE, "Entering prompt");
shenv.meta_mut().stop_timer();
let ps1 = std::env::var("PS1").unwrap_or("\\$ ".styled(Style::Green | Style::Bold));
let prompt = expand_prompt(&ps1,shenv)?;
let mut editor = init_rl(shenv);