rewrite: removed unneeded operations

This commit is contained in:
iff 2023-08-06 11:20:43 +02:00
parent 10a23a7e09
commit 18f5627587

View file

@ -23,9 +23,8 @@ fn last_command(shell: &str) -> String {
let last_command = std::env::var("_PR_LAST_COMMAND").expect("No _PR_LAST_COMMAND in environment. Did you aliased the command with the correct argument?"); let last_command = std::env::var("_PR_LAST_COMMAND").expect("No _PR_LAST_COMMAND in environment. Did you aliased the command with the correct argument?");
match shell { match shell {
"bash" => { "bash" => {
let first_line = last_command.lines().next().unwrap(); let first_line = last_command.lines().next().unwrap().trim();
let split = first_line.split_whitespace().collect::<Vec<&str>>(); first_line.split_once(" ").unwrap().1.to_string()
split[1..].join(" ")
} }
"zsh" => last_command, "zsh" => last_command,
"fish" => last_command, "fish" => last_command,