diff --git a/README.md b/README.md index d2af762..0b58640 100644 --- a/README.md +++ b/README.md @@ -120,9 +120,9 @@ Dots and slashes can be repeated to move to parent tasks. Property Filters: -- `#TAG` - set tag filter (empty: list all used tags) +- `#TAG1 TAG2` - set tag filter (empty: list all used tags) - `+TAG` - add tag filter -- `-TAG` - remove tag filters +- `-TAG` - remove tag filters by prefix - `?STATUS` - filter by status (type or description) - plain `?` to reset, `??` to show all - `@AUTHOR` - filter by author (`@` for self, id prefix, name prefix) - TBI: Filter by time diff --git a/src/main.rs b/src/main.rs index ce483f9..1ec7603 100644 --- a/src/main.rs +++ b/src/main.rs @@ -18,6 +18,7 @@ use env_logger::Builder; use itertools::Itertools; use log::{debug, error, info, LevelFilter, trace, warn}; use nostr_sdk::prelude::*; +use nostr_sdk::TagStandard::Hashtag; use regex::Regex; use xdg::BaseDirectories; @@ -456,7 +457,7 @@ async fn main() { Some('#') => match arg { - Some(arg) => tasks.set_tag(arg.to_string()), + Some(arg) => tasks.set_tags(arg.split_whitespace().map(|s| Hashtag(s.to_string()).into())), None => { println!("Hashtags of all known tasks:\n{}", tasks.all_hashtags().join(" ")); continue; diff --git a/src/tasks.rs b/src/tasks.rs index eb70139..74bb71e 100644 --- a/src/tasks.rs +++ b/src/tasks.rs @@ -128,6 +128,7 @@ impl Tasks { ], sorting: VecDeque::from([ "state".into(), + "hashtags".into(), "rtime".into(), "name".into(), ]), @@ -485,10 +486,10 @@ impl Tasks { info!("Removed all filters"); } - pub(crate) fn set_tag(&mut self, tag: String) { + pub(crate) fn set_tags(&mut self, tags: impl IntoIterator) { self.tags_excluded.clear(); self.tags.clear(); - self.add_tag(tag); + self.tags.extend(tags); } pub(crate) fn add_tag(&mut self, tag: String) {