commit b0d5b9d2faccfd554d6452466c6aba5327e6efe0 from: witcher date: Sun Apr 3 19:46:47 2022 UTC adaptive year, improved recurring task warning commit - 63c26bda4f4a82eca9b3962373e90e61f27d4a2e commit + b0d5b9d2faccfd554d6452466c6aba5327e6efe0 blob - e921909e9c644446cc7b17341452ea2e74e83ae6 blob + be242cc0a03c4aa47252cb0d6cd285d549bc38b0 --- README.md +++ README.md @@ -7,7 +7,7 @@ Features: - Content/Description (converted to a single string) - Priority -- Due date (with "due:YYYY-MM-DD" key-value tag, "YYYY" is automatically filled with "2022") +- Due date (with "due:YYYY-MM-DD" key-value tag, "YYYY" is automatically filled with the current year) - Project Tag - Context Tag blob - 1359a99bc9ee120b7f3dbcdac3e22cff65baff32 blob + 60f696555851c65e85aa9d10c9386b2f23adef4d --- src/main.rs +++ src/main.rs @@ -57,9 +57,10 @@ fn convert_to_todotxt(tasks: Vec, project: Str let mut d = if !due.starts_with("[0-9]{2}") { format!("0{due}") } else { - due + due.clone() }; - d.push_str(" 2022"); + d.push(' '); + d.push_str(&chrono::prelude::Utc::now().format("%Y").to_string()); match NaiveDate::parse_from_str(&d, "%d %b %H:%M %Y") { Ok(_d) => { @@ -67,8 +68,8 @@ fn convert_to_todotxt(tasks: Vec, project: Str out.push_str(&_d.format("%Y-%m-%d").to_string()); } Err(_) => eprintln!( - "Attention: Task with content \"{}\" contains recurring task. Manual fix required!", - task.content + "Attention: Task contains recurring task. Manual fix required! \"{} {}\"", + task.content, due ), } }