mirror of
https://github.com/TECHNOFAB11/pay-respects.git
synced 2025-12-12 14:30:10 +01:00
utils!: consistent function name
This commit is contained in:
parent
a136a2f5d1
commit
ab557e9b86
4 changed files with 6 additions and 6 deletions
|
|
@ -5,7 +5,7 @@ use crate::{shell, suggestions};
|
||||||
use colored::Colorize;
|
use colored::Colorize;
|
||||||
use inquire::*;
|
use inquire::*;
|
||||||
use pay_respects_utils::evals::best_match_path;
|
use pay_respects_utils::evals::best_match_path;
|
||||||
use pay_respects_utils::files::get_best_match_file;
|
use pay_respects_utils::files::best_match_file;
|
||||||
|
|
||||||
use std::path::Path;
|
use std::path::Path;
|
||||||
|
|
||||||
|
|
@ -69,7 +69,7 @@ pub fn cnf(data: &mut Data) {
|
||||||
|
|
||||||
let best_match = {
|
let best_match = {
|
||||||
if executable.contains(std::path::MAIN_SEPARATOR) {
|
if executable.contains(std::path::MAIN_SEPARATOR) {
|
||||||
get_best_match_file(executable)
|
best_match_file(executable)
|
||||||
} else {
|
} else {
|
||||||
best_match_path(executable, &data.executables)
|
best_match_path(executable, &data.executables)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
[package]
|
[package]
|
||||||
name = "pay-respects-utils"
|
name = "pay-respects-utils"
|
||||||
version = "0.1.0"
|
version = "0.1.1"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
|
|
||||||
# for crates.io
|
# for crates.io
|
||||||
|
|
|
||||||
|
|
@ -83,7 +83,7 @@ pub fn suggest_typo(typos: &[String], candidates: Vec<String>, executables: &[St
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
"file" => {
|
"file" => {
|
||||||
if let Some(suggest) = get_best_match_file(typo) {
|
if let Some(suggest) = best_match_file(typo) {
|
||||||
suggestions.push(suggest);
|
suggestions.push(suggest);
|
||||||
} else {
|
} else {
|
||||||
suggestions.push(typo.to_string());
|
suggestions.push(typo.to_string());
|
||||||
|
|
|
||||||
|
|
@ -44,10 +44,10 @@ pub fn get_path_files() -> Vec<String> {
|
||||||
all_executable
|
all_executable
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn get_best_match_file(input: &str) -> Option<String> {
|
pub fn best_match_file(input: &str) -> Option<String> {
|
||||||
let mut input = input.trim_matches(|c| c == '\'' || c == '"').to_owned();
|
let mut input = input.trim_matches(|c| c == '\'' || c == '"').to_owned();
|
||||||
if cfg!(debug_assertions) {
|
if cfg!(debug_assertions) {
|
||||||
eprintln!("get_best_match_file input: {input}");
|
eprintln!("best_match_file input: {input}");
|
||||||
}
|
}
|
||||||
let mut exit_dirs = Vec::new();
|
let mut exit_dirs = Vec::new();
|
||||||
let mut files = loop {
|
let mut files = loop {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue