discarded status given in task view

This commit is contained in:
aaron-jack-manning 2022-08-21 11:09:22 +10:00
parent c8df51dd67
commit 973f316bc0
2 changed files with 8 additions and 2 deletions

View File

@ -30,3 +30,7 @@ pub fn id(text : &str) -> colored::ColoredString {
text.truecolor(52, 152, 219) text.truecolor(52, 152, 219)
} }
// Grey
pub fn greyed_out(text : &str) -> colored::ColoredString {
text.truecolor(99, 110, 114)
}

View File

@ -199,9 +199,11 @@ impl Task {
} }
let id = &self.data.id.to_string(); let id = &self.data.id.to_string();
let heading = format!("[{}] {} {}", if self.data.complete {"X"} else {" "}, colour::id(&id), colour::task_name(&self.data.name)); let discarded = if self.data.discarded { String::from(" (discarded)") } else { String::new() };
let heading = format!("[{}] {} {}{}", if self.data.complete {"X"} else {" "}, colour::id(&id), colour::task_name(&self.data.name), colour::greyed_out(&discarded));
println!("{}", heading); println!("{}", heading);
line(5 + self.data.name.len() + id.len());
line(5 + self.data.name.chars().count() + id.chars().count() + discarded.chars().count());
println!("Priority: {}", self.data.priority.coloured()); println!("Priority: {}", self.data.priority.coloured());
println!("Tags: [{}]", format_hash_set(&self.data.tags)?); println!("Tags: [{}]", format_hash_set(&self.data.tags)?);
println!("Created: {}", self.data.created); println!("Created: {}", self.data.created);