chore: perform bash history in shell

This commit is contained in:
iff 2024-11-24 12:52:49 +01:00
parent 84802c4a9c
commit 6feb88d48f

View file

@ -54,10 +54,7 @@ pub fn last_command(shell: &str) -> String {
}; };
match shell { match shell {
"bash" => { "bash" => last_command,
let first_line = last_command.lines().next().unwrap().trim();
first_line.split_once(' ').unwrap().1.to_string()
}
"zsh" => last_command, "zsh" => last_command,
"fish" => last_command, "fish" => last_command,
"nu" => last_command, "nu" => last_command,
@ -152,7 +149,7 @@ pub fn initialization(shell: &str, binary_path: &str, auto_alias: &str, cnf: boo
match shell { match shell {
"bash" => { "bash" => {
last_command = "$(history 2)"; last_command = r"$(history 2 | head -n 1 | sed 's/^\s*[0-9]*//')";
alias = "$(alias)" alias = "$(alias)"
} }
"zsh" => { "zsh" => {