From 26596712e8ba26e5022dcc7d631c806262624b45 Mon Sep 17 00:00:00 2001 From: Alexis Bourget Date: Mon, 23 Nov 2020 14:17:54 +0100 Subject: [PATCH] Use FuzzyFinder instead of Fzf, with the proper command name in errors --- src/cmd/query.rs | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/cmd/query.rs b/src/cmd/query.rs index 24bafcc..a0b3753 100644 --- a/src/cmd/query.rs +++ b/src/cmd/query.rs @@ -1,6 +1,6 @@ use super::Cmd; use crate::config; -use crate::fzf::Fzf; +use crate::fuzzy_finder::FuzzyFinder; use crate::util; use crate::store::{self, Store}; @@ -38,18 +38,19 @@ impl Cmd for Query { let mut matches = store.iter_matches(&query, now); if self.interactive { - let mut fzf = Fzf::new()?; - let handle = fzf.stdin(); + let mut fuzzy_finder = FuzzyFinder::new()?; + let fuzzy_finder_cmd = fuzzy_finder.cmd_name(); + let handle = fuzzy_finder.stdin(); for dir in matches { - writeln!(handle, "{}", dir.display_score(now)).context("could not write to fzf")?; + writeln!(handle, "{}", dir.display_score(now)).with_context(|| format!("could not write to {}", fuzzy_finder_cmd))?; } - let selection = fzf.wait_select()?; + let selection = fuzzy_finder.wait_select()?; if self.score { print!("{}", selection); } else { let path = selection .get(5..) - .context("could not read selection from fzf")?; + .with_context(|| format!("could not read selection from {}", fuzzy_finder_cmd))?; print!("{}", path) } } else if self.list {