mirror of
https://github.com/TECHNOFAB11/pay-respects.git
synced 2025-12-12 06:20:09 +01:00
feat: fuzzy search not found commands
This commit is contained in:
parent
86ae6a6fb4
commit
135abc75b6
5 changed files with 177 additions and 27 deletions
11
src/shell.rs
11
src/shell.rs
|
|
@ -1,4 +1,4 @@
|
|||
use std::{process::exit};
|
||||
use std::process::exit;
|
||||
|
||||
pub const PRIVILEGE_LIST: [&str; 2] = ["sudo", "doas"];
|
||||
|
||||
|
|
@ -45,12 +45,11 @@ pub fn last_command_expanded_alias(shell: &str) -> String {
|
|||
}
|
||||
|
||||
let split_command = last_command.split_whitespace().collect::<Vec<&str>>();
|
||||
let command;
|
||||
if PRIVILEGE_LIST.contains(&split_command[0]) {
|
||||
command = split_command[1];
|
||||
let command = if PRIVILEGE_LIST.contains(&split_command[0]) {
|
||||
split_command[1]
|
||||
} else {
|
||||
command = split_command[0];
|
||||
}
|
||||
split_command[0]
|
||||
};
|
||||
|
||||
let mut expanded_command = command.to_string();
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue