fix: opts extra space

This commit is contained in:
iff 2024-12-07 01:51:15 +01:00
parent 22120b7616
commit 0ef6ea1ff9
6 changed files with 11 additions and 6 deletions

4
Cargo.lock generated
View file

@ -485,9 +485,9 @@ dependencies = [
[[package]]
name = "pay-respects-parser"
version = "0.3.0"
version = "0.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "716539357624a94d3c0ae1ba4705211a649e09dfb108443abd35a1e223dee378"
checksum = "a5d494017aca21a2231e685b0d495a0f1b17ebcc81d6e43f7dd5fe7761cd73fb"
dependencies = [
"proc-macro2",
"quote",

View file

@ -27,7 +27,7 @@ textwrap = { version = "0.16", features = ["terminal_size"], optional = true }
inquire = "0.7.5"
pay-respects-parser = "0.3"
pay-respects-parser = "0.3.1"
# pay-respects-parser = { path = "../pay-respects-parser" }
[features]

View file

@ -7,6 +7,9 @@ pattern = [
]
suggest = [
'''
cd {{typo[1](file)}}
''',
'''
#[!shell(nu)]
mkdir --parents {{command[1]}} && \
cd {{command[1]}} '''

View file

@ -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());

View file

@ -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();