From 3e056eb2b6abafcef8a7b702eed4a397e9832eaf Mon Sep 17 00:00:00 2001 From: xeruf <27jf@pm.me> Date: Thu, 15 Aug 2024 10:33:52 +0300 Subject: [PATCH] feat: feedback when filter does not match --- src/main.rs | 2 +- src/tasks.rs | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/main.rs b/src/main.rs index 03a6f96..141df6e 100644 --- a/src/main.rs +++ b/src/main.rs @@ -406,13 +406,13 @@ async fn main() { match arg { None => match tasks.get_position() { None => { + info!("Filtering for Procedures"); tasks.set_filter( tasks.filtered_tasks(None) .filter(|t| t.pure_state() == State::Procedure) .map(|t| t.event.id) .collect() ); - info!("Filtering for procedures"); } Some(id) => { tasks.set_state_for(id, "", State::Procedure); diff --git a/src/tasks.rs b/src/tasks.rs index 1522c0d..7c0f167 100644 --- a/src/tasks.rs +++ b/src/tasks.rs @@ -480,6 +480,9 @@ impl Tasks { // Movement and Selection pub(crate) fn set_filter(&mut self, view: Vec) { + if view.is_empty() { + warn!("No match for filter!") + } self.view = view; } @@ -565,7 +568,7 @@ impl Tasks { if arg.len() > 2 { Some(self.make_task(arg)) } else { - warn!("Not creating task under 3 chars to avoid silly mistakes"); + warn!("Name of a task needs to have at least 3 characters"); None } }