Implemented cmd runtime expansion for the prompt

This commit is contained in:
2025-03-09 03:51:49 -04:00
parent 41582672d5
commit e118844d57
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);

View File

@@ -13,9 +13,6 @@ pub fn check_delims(line: &str) -> bool {
while let Some(ch) = chars.next() {
case_check.push(ch);
if case_check.len() > 4 {
case_check = case_check[1..].to_string();
}
if case_check.ends_with("case") {
case_depth += 1;
}