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

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)]