diff --git a/src/shell.rs b/src/shell.rs index 428903f..35242e2 100644 --- a/src/shell.rs +++ b/src/shell.rs @@ -76,7 +76,7 @@ pub fn expand_alias(shell: &str, full_command: &str) -> String { } let split_command = full_command.split_whitespace().collect::>(); - let (command, pure_command) = if PRIVILEGE_LIST.contains(&split_command[0]) { + let (command, pure_command) = if PRIVILEGE_LIST.contains(&split_command[0]) && split_command.len() > 1 { (split_command[1], Some(split_command[1..].join(" "))) } else { (split_command[0], None) diff --git a/src/suggestions.rs b/src/suggestions.rs index 10a2b9d..2c5a889 100644 --- a/src/suggestions.rs +++ b/src/suggestions.rs @@ -273,8 +273,14 @@ pub fn confirm_suggestion(shell: &str, command: &str, highlighted: &str) -> Resu if !command.starts_with(&_p) { continue; } - let mut command = command.replacen(&_p, "", 1); - command = expand_alias_multiline(shell, &command); + + let command = { + let mut command = command.replacen(&_p, "", 1); + if command != " " { + command = expand_alias_multiline(shell, &command); + } + command + }; let now = Instant::now(); let process = run_suggestion_p(shell, p, &command);