diff --git a/Cargo.lock b/Cargo.lock index 63ae8c7..208356e 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -173,7 +173,7 @@ checksum = "e496a50fda8aacccc86d7529e2c1e0892dbd0f898a6b5645b5561b89c3210efa" [[package]] name = "day-reporter" -version = "1.3.1" +version = "1.4.0" dependencies = [ "anyhow", "chrono", diff --git a/Cargo.toml b/Cargo.toml index f0472e7..44e805d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "day-reporter" -version = "1.3.1" +version = "1.4.0" edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html diff --git a/src/main.rs b/src/main.rs index 914723b..1af7bf4 100644 --- a/src/main.rs +++ b/src/main.rs @@ -70,6 +70,11 @@ struct CliArgs { #[arg(short, long)] tags: Vec, + /// A list of tags to specifically omit from the results. Only todo list items WITHOUT these + /// tags will be included + #[arg(short, long)] + omit: Vec, + /// Select the type of report to generate #[arg(short, long, default_value_t = ReportTypes::default())] #[clap(value_enum)] @@ -90,7 +95,8 @@ fn main() -> Result<()> { ReportTypes::Cycle => Task::logbook_this_cycle(), }?; let mut reported: Vec = tasks.into_iter().filter(|task| { - args.tags.iter().all(|tag| task.has_tag(tag)) + // Filter down to tasks with all selected tags and without any of the omitted tags + args.tags.iter().all(|tag| task.has_tag(tag)) && !args.omit.iter().any(|tag| task.has_tag(tag)) }).collect(); reported.sort_by(|a, b| { a.completion_date.cmp(&b.completion_date)