From ab557e9b867ed62a1f06d8cb0623d1b80be40bfd Mon Sep 17 00:00:00 2001 From: iff Date: Mon, 9 Dec 2024 16:27:39 +0100 Subject: [PATCH] utils!: consistent function name --- core/src/modes.rs | 4 ++-- utils/Cargo.toml | 2 +- utils/src/evals.rs | 2 +- utils/src/files.rs | 4 ++-- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/core/src/modes.rs b/core/src/modes.rs index e368586..6bb31c3 100644 --- a/core/src/modes.rs +++ b/core/src/modes.rs @@ -5,7 +5,7 @@ use crate::{shell, suggestions}; use colored::Colorize; use inquire::*; 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; @@ -69,7 +69,7 @@ pub fn cnf(data: &mut Data) { let best_match = { if executable.contains(std::path::MAIN_SEPARATOR) { - get_best_match_file(executable) + best_match_file(executable) } else { best_match_path(executable, &data.executables) } diff --git a/utils/Cargo.toml b/utils/Cargo.toml index d45cea8..546cfe8 100644 --- a/utils/Cargo.toml +++ b/utils/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "pay-respects-utils" -version = "0.1.0" +version = "0.1.1" edition = "2021" # for crates.io diff --git a/utils/src/evals.rs b/utils/src/evals.rs index 83883e9..1a6ef13 100644 --- a/utils/src/evals.rs +++ b/utils/src/evals.rs @@ -83,7 +83,7 @@ pub fn suggest_typo(typos: &[String], candidates: Vec, executables: &[St } } "file" => { - if let Some(suggest) = get_best_match_file(typo) { + if let Some(suggest) = best_match_file(typo) { suggestions.push(suggest); } else { suggestions.push(typo.to_string()); diff --git a/utils/src/files.rs b/utils/src/files.rs index 245fc88..3835882 100644 --- a/utils/src/files.rs +++ b/utils/src/files.rs @@ -44,10 +44,10 @@ pub fn get_path_files() -> Vec { all_executable } -pub fn get_best_match_file(input: &str) -> Option { +pub fn best_match_file(input: &str) -> Option { let mut input = input.trim_matches(|c| c == '\'' || c == '"').to_owned(); 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 files = loop {