Autocompleting to command when starting with sudo or watch

This commit is contained in:
Justine Pelletreau 2023-11-16 18:19:37 +01:00
parent cf6a9961d1
commit 0d57b7a40c
2 changed files with 6 additions and 1 deletions

View File

@ -713,7 +713,7 @@ pub mod shell {
&elems.conf.update_prompt(get_curr_history_number()); &elems.conf.update_prompt(get_curr_history_number());
//Initializing //Initializing
write!(elems.stdout, "\r\n ---Sqish initializing--- \r\n{}", elems.conf.promptline); //write!(elems.stdout, "\r\n ---Sqish initializing--- \r\n{}", elems.conf.promptline);
elems.stdout.flush(); elems.stdout.flush();
set_envvars(&elems.conf.env); set_envvars(&elems.conf.env);

View File

@ -109,10 +109,15 @@ impl Search {
fn discriminate_search_type(input: &String) -> SearchType { fn discriminate_search_type(input: &String) -> SearchType {
let tamere = input.clone(); let tamere = input.clone();
//Special cases
//./Means we want to execute something in place //./Means we want to execute something in place
if input.starts_with("./") || input.starts_with(" ./") { if input.starts_with("./") || input.starts_with(" ./") {
return SearchType::FileSearch; return SearchType::FileSearch;
} }
if input.starts_with("sudo") || input.starts_with("watch ") {
return SearchType::CmdSearch;
}
let mut a = tamere.split(" ").collect::<Vec<&str>>(); let mut a = tamere.split(" ").collect::<Vec<&str>>();
let _y = String::from(a.pop().unwrap()); let _y = String::from(a.pop().unwrap());