Handle canceled tasks

This commit is contained in:
Campbell Alden 2024-03-13 18:17:50 +09:00
parent f1ac5bb718
commit 29d1d5a2ef
4 changed files with 12 additions and 4 deletions

2
Cargo.lock generated
View file

@ -173,7 +173,7 @@ checksum = "e496a50fda8aacccc86d7529e2c1e0892dbd0f898a6b5645b5561b89c3210efa"
[[package]]
name = "day-reporter"
version = "1.3.0"
version = "1.3.1"
dependencies = [
"anyhow",
"chrono",

View file

@ -1,6 +1,6 @@
[package]
name = "day-reporter"
version = "1.3.0"
version = "1.3.1"
edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

View file

@ -1,4 +1,4 @@
use crate::things::task::Task;
use crate::things::task::{Task, Status};
use crate::names::sanitize_names;
/// Given a notes field and a list of possible tags for sections, return the content of triple tick
@ -176,10 +176,16 @@ impl Reporter for MarkdownReporter {
.map(|l| format!("\n{}- {}", String::from(" ").repeat(depth + 4), l))
.collect::<Vec<String>>()
.join("");
let mut output = format!("\n{}- {}{}", String::from(" ").repeat(depth), task.title, relevant_notes);
let title = if task.status == Status::Canceled {
format!("~{}~", task.title)
} else {
task.title.to_string()
};
let mut output = format!("\n{}- {}{}", String::from(" ").repeat(depth), title, relevant_notes);
if options.sanitize_names {
output = sanitize_names(&output, &task.tags);
}
output
}
fn report_project(&mut self, project: &ProjectTree, depth: usize, options: &ReportOptions) -> String {

View file

@ -13,6 +13,8 @@ pub enum Status {
Incomplete,
#[serde(rename = "open")]
Open,
#[serde(rename = "canceled")]
Canceled,
}
#[derive(Deserialize, Debug)]