fix: trim newlines when expanding alias

This commit is contained in:
iff 2025-03-12 03:18:28 +01:00
parent d76a244a1a
commit cf04753c2b
3 changed files with 9 additions and 2 deletions

View file

@ -163,12 +163,14 @@ impl Data {
};
init.split();
init.expand_command();
if init.mode != Mode::Cnf {
init.update_error(None);
}
#[cfg(debug_assertions)]
{
eprintln!("/// data initialization");
eprintln!("shell: {}", init.shell);
eprintln!("command: {}", init.command);
eprintln!("error: {}", init.error);
@ -209,6 +211,8 @@ impl Data {
self.command = self.command.replacen(&split[0], "", 1).trim().to_string();
self.privilege = Some(split.remove(0))
}
#[cfg(debug_assertions)]
eprintln!("split: {:?}", split);
self.split = split;
}
@ -454,7 +458,7 @@ pub fn expand_alias_multiline(map: &HashMap<String, String>, command: &str) -> O
}
}
if expansion {
Some(expanded)
Some(expanded.trim().to_string())
} else {
None
}