mirror of
https://github.com/TECHNOFAB11/pay-respects.git
synced 2026-02-02 07:35:10 +01:00
fix: opts extra space
This commit is contained in:
parent
22120b7616
commit
0ef6ea1ff9
6 changed files with 11 additions and 6 deletions
4
Cargo.lock
generated
4
Cargo.lock
generated
|
|
@ -485,9 +485,9 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "pay-respects-parser"
|
name = "pay-respects-parser"
|
||||||
version = "0.3.0"
|
version = "0.3.1"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "716539357624a94d3c0ae1ba4705211a649e09dfb108443abd35a1e223dee378"
|
checksum = "a5d494017aca21a2231e685b0d495a0f1b17ebcc81d6e43f7dd5fe7761cd73fb"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
|
|
|
||||||
|
|
@ -27,7 +27,7 @@ textwrap = { version = "0.16", features = ["terminal_size"], optional = true }
|
||||||
|
|
||||||
inquire = "0.7.5"
|
inquire = "0.7.5"
|
||||||
|
|
||||||
pay-respects-parser = "0.3"
|
pay-respects-parser = "0.3.1"
|
||||||
# pay-respects-parser = { path = "../pay-respects-parser" }
|
# pay-respects-parser = { path = "../pay-respects-parser" }
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,9 @@ pattern = [
|
||||||
]
|
]
|
||||||
suggest = [
|
suggest = [
|
||||||
'''
|
'''
|
||||||
|
cd {{typo[1](file)}}
|
||||||
|
''',
|
||||||
|
'''
|
||||||
#[!shell(nu)]
|
#[!shell(nu)]
|
||||||
mkdir --parents {{command[1]}} && \
|
mkdir --parents {{command[1]}} && \
|
||||||
cd {{command[1]}} '''
|
cd {{command[1]}} '''
|
||||||
|
|
|
||||||
|
|
@ -130,7 +130,7 @@ pub fn get_best_match_file(input: &str) -> Option<String> {
|
||||||
})
|
})
|
||||||
.collect::<Vec<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()?;
|
best_match.as_ref()?;
|
||||||
|
|
||||||
input = format!("{}/{}", input, best_match.unwrap());
|
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 mut replace_tag = 0;
|
||||||
let tag_name = "opts";
|
let tag_name = "opts";
|
||||||
|
|
||||||
while suggest.contains("{{opt::") {
|
while suggest.contains(" {{opt::") {
|
||||||
let (placeholder, args) = eval_placeholder(suggest, "{{opt::", "}}");
|
let (placeholder, args) = eval_placeholder(suggest, " {{opt::", "}}");
|
||||||
|
|
||||||
let opt = &suggest[args.to_owned()];
|
let opt = &suggest[args.to_owned()];
|
||||||
let regex = opt.trim();
|
let regex = opt.trim();
|
||||||
|
|
|
||||||
|
|
@ -58,6 +58,8 @@ pub fn suggest_candidates(data: &mut Data) {
|
||||||
|
|
||||||
pub fn select_candidate(data: &mut Data) {
|
pub fn select_candidate(data: &mut Data) {
|
||||||
let candidates = &data.candidates;
|
let candidates = &data.candidates;
|
||||||
|
#[cfg(debug_assertions)]
|
||||||
|
eprintln!("candidates: {candidates:?}");
|
||||||
if candidates.len() == 1 {
|
if candidates.len() == 1 {
|
||||||
let suggestion = candidates[0].to_string();
|
let suggestion = candidates[0].to_string();
|
||||||
let highlighted = highlight_difference(&data.shell, &suggestion, &data.command).unwrap();
|
let highlighted = highlight_difference(&data.shell, &suggestion, &data.command).unwrap();
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue