mirror of
https://github.com/TECHNOFAB11/pay-respects.git
synced 2025-12-11 22:10:09 +01:00
refactor: shell syntax
This commit is contained in:
parent
bdc1327d29
commit
e297aa3def
3 changed files with 18 additions and 20 deletions
|
|
@ -8,13 +8,16 @@ use inquire::*;
|
|||
use ui::Color;
|
||||
|
||||
use crate::rules::match_pattern;
|
||||
use crate::shell::{add_candidates_no_dup, module_output, shell_evaluated_commands, Data};
|
||||
use crate::shell::{
|
||||
add_candidates_no_dup, module_output, shell_evaluated_commands, shell_syntax, Data,
|
||||
};
|
||||
use crate::style::highlight_difference;
|
||||
|
||||
pub fn suggest_candidates(data: &mut Data) {
|
||||
if data.split.is_empty() {
|
||||
return;
|
||||
}
|
||||
let shell = &data.shell;
|
||||
let executable = &data.split[0]
|
||||
.rsplit(std::path::MAIN_SEPARATOR)
|
||||
.next()
|
||||
|
|
@ -70,14 +73,20 @@ pub fn suggest_candidates(data: &mut Data) {
|
|||
}
|
||||
|
||||
if !final_candidates.is_empty() {
|
||||
data.candidates = final_candidates;
|
||||
data.candidates = final_candidates
|
||||
.iter()
|
||||
.map(|s| shell_syntax(shell, s))
|
||||
.collect();
|
||||
return;
|
||||
}
|
||||
for fallback in fallbacks {
|
||||
let candidates = module_output(data, fallback);
|
||||
if candidates.is_some() {
|
||||
add_candidates_no_dup(command, &mut final_candidates, &candidates.unwrap());
|
||||
data.candidates = final_candidates;
|
||||
data.candidates = final_candidates
|
||||
.iter()
|
||||
.map(|s| shell_syntax(shell, s))
|
||||
.collect();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue