From 18f5627587ab5a03b000c8b7b087c2b1ef975dde Mon Sep 17 00:00:00 2001 From: iff Date: Sun, 6 Aug 2023 11:20:43 +0200 Subject: [PATCH] rewrite: removed unneeded operations --- src/shell.rs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/shell.rs b/src/shell.rs index 3cac7ae..aaea440 100644 --- a/src/shell.rs +++ b/src/shell.rs @@ -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?"); match shell { "bash" => { - let first_line = last_command.lines().next().unwrap(); - let split = first_line.split_whitespace().collect::>(); - split[1..].join(" ") + let first_line = last_command.lines().next().unwrap().trim(); + first_line.split_once(" ").unwrap().1.to_string() } "zsh" => last_command, "fish" => last_command,