forked from janek/mostr
1
0
Fork 0

feat: feedback when filter does not match

This commit is contained in:
xeruf 2024-08-15 10:33:52 +03:00
parent 930c6b9c38
commit 3e056eb2b6
2 changed files with 5 additions and 2 deletions

View File

@ -406,13 +406,13 @@ async fn main() {
match arg { match arg {
None => match tasks.get_position() { None => match tasks.get_position() {
None => { None => {
info!("Filtering for Procedures");
tasks.set_filter( tasks.set_filter(
tasks.filtered_tasks(None) tasks.filtered_tasks(None)
.filter(|t| t.pure_state() == State::Procedure) .filter(|t| t.pure_state() == State::Procedure)
.map(|t| t.event.id) .map(|t| t.event.id)
.collect() .collect()
); );
info!("Filtering for procedures");
} }
Some(id) => { Some(id) => {
tasks.set_state_for(id, "", State::Procedure); tasks.set_state_for(id, "", State::Procedure);

View File

@ -480,6 +480,9 @@ impl Tasks {
// Movement and Selection // Movement and Selection
pub(crate) fn set_filter(&mut self, view: Vec<EventId>) { pub(crate) fn set_filter(&mut self, view: Vec<EventId>) {
if view.is_empty() {
warn!("No match for filter!")
}
self.view = view; self.view = view;
} }
@ -565,7 +568,7 @@ impl Tasks {
if arg.len() > 2 { if arg.len() > 2 {
Some(self.make_task(arg)) Some(self.make_task(arg))
} else { } 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 None
} }
} }