feat: multiline alias expansion

This commit is contained in:
iff 2024-11-17 14:57:22 +01:00
parent ae7307ad3a
commit f1f7ed8dbe
3 changed files with 29 additions and 21 deletions

View file

@ -8,7 +8,7 @@ use regex_lite::Regex;
use crate::files::{get_best_match_file, get_path_files};
use crate::rules::match_pattern;
use crate::shell::{expand_alias, PRIVILEGE_LIST};
use crate::shell::{expand_alias_multiline, PRIVILEGE_LIST};
pub fn suggest_command(shell: &str, last_command: &str, error_msg: &str) -> Option<String> {
let split_command = split_command(last_command);
@ -221,7 +221,7 @@ pub fn confirm_suggestion(shell: &str, command: &str, highlighted: &str) -> Resu
continue;
}
let mut command = command.replacen(&_p, "", 1);
command = expand_alias(shell, &command);
command = expand_alias_multiline(shell, &command);
let now = Instant::now();
let process = std::process::Command::new(p)
@ -258,7 +258,7 @@ pub fn confirm_suggestion(shell: &str, command: &str, highlighted: &str) -> Resu
}
}
let command = expand_alias(shell, command);
let command = expand_alias_multiline(shell, command);
let now = Instant::now();
let process = std::process::Command::new(shell)
.arg("-c")