mirror of
https://github.com/TECHNOFAB11/pay-respects.git
synced 2025-12-15 07:43:51 +01:00
fix: opts extra space
This commit is contained in:
parent
22120b7616
commit
0ef6ea1ff9
6 changed files with 11 additions and 6 deletions
|
|
@ -130,7 +130,7 @@ pub fn get_best_match_file(input: &str) -> Option<String> {
|
|||
})
|
||||
.collect::<Vec<String>>();
|
||||
|
||||
let best_match = find_similar(&exit_dir, &dir_files, Some(1));
|
||||
let best_match = find_similar(&exit_dir, &dir_files, Some(2));
|
||||
best_match.as_ref()?;
|
||||
|
||||
input = format!("{}/{}", input, best_match.unwrap());
|
||||
|
|
|
|||
|
|
@ -23,8 +23,8 @@ pub fn opts(suggest: &mut String, last_command: &mut String, opt_list: &mut Vec<
|
|||
let mut replace_tag = 0;
|
||||
let tag_name = "opts";
|
||||
|
||||
while suggest.contains("{{opt::") {
|
||||
let (placeholder, args) = eval_placeholder(suggest, "{{opt::", "}}");
|
||||
while suggest.contains(" {{opt::") {
|
||||
let (placeholder, args) = eval_placeholder(suggest, " {{opt::", "}}");
|
||||
|
||||
let opt = &suggest[args.to_owned()];
|
||||
let regex = opt.trim();
|
||||
|
|
|
|||
|
|
@ -58,6 +58,8 @@ pub fn suggest_candidates(data: &mut Data) {
|
|||
|
||||
pub fn select_candidate(data: &mut Data) {
|
||||
let candidates = &data.candidates;
|
||||
#[cfg(debug_assertions)]
|
||||
eprintln!("candidates: {candidates:?}");
|
||||
if candidates.len() == 1 {
|
||||
let suggestion = candidates[0].to_string();
|
||||
let highlighted = highlight_difference(&data.shell, &suggestion, &data.command).unwrap();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue