From dc6eb12b7357e71a53b3c0e202159cde4a0968b0 Mon Sep 17 00:00:00 2001 From: iff Date: Tue, 8 Aug 2023 17:56:44 +0200 Subject: [PATCH] fix: don't remove additional privilage commands (symlink) --- src/suggestions.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/suggestions.rs b/src/suggestions.rs index dc08dba..b753cbd 100644 --- a/src/suggestions.rs +++ b/src/suggestions.rs @@ -191,14 +191,14 @@ fn compare_string(a: &str, b: &str) -> usize { } pub fn confirm_suggestion(shell: &str, command: &str, highlighted: &str) -> Result<(), ()> { - println! {"{}\n", highlighted} + println!("{}\n", highlighted); println!("Press enter to execute the suggestion. Or press Ctrl+C to exit."); std::io::stdin().read_line(&mut String::new()).unwrap(); for p in PRIVILEGE_LIST { let _p = p.to_owned() + " "; if command.starts_with(&_p) { - let command = command.replace(p, ""); + let command = command.replacen(p, "", 1); let process = std::process::Command::new(p) .arg(shell) .arg("-c")