From 4056cd2a60f848debce8447c680e75fa67a3ae22 Mon Sep 17 00:00:00 2001 From: aaron-jack-manning Date: Mon, 5 Sep 2022 10:13:23 +1000 Subject: [PATCH] backlog priority level --- src/format.rs | 3 +++ src/tasks.rs | 12 +----------- 2 files changed, 4 insertions(+), 11 deletions(-) diff --git a/src/format.rs b/src/format.rs index 3f16742..da6d0e7 100755 --- a/src/format.rs +++ b/src/format.rs @@ -37,6 +37,7 @@ pub mod priority { pub static LOW : (u8, u8, u8) = (46, 204, 113); pub static MEDIUM : (u8, u8, u8) = (241, 196, 15); pub static HIGH : (u8, u8, u8) = (231, 76, 60); + pub static BACKLOG : (u8, u8, u8) = (99, 110, 114); } fn text(string : &str, colour : (u8, u8, u8)) -> colored::ColoredString { @@ -78,6 +79,7 @@ pub fn profile(string : &str) -> colored::ColoredString { pub fn priority(priority : &tasks::Priority) -> String { use tasks::Priority::*; let priority = match priority { + Backlog => text("backlog", priority::BACKLOG), Low => text("low", priority::LOW), Medium => text("medium", priority::MEDIUM), High => text("high", priority::HIGH), @@ -206,6 +208,7 @@ pub mod cell { pub fn priority(priority : &tasks::Priority) -> comfy_table::Cell { use tasks::Priority::*; match priority { + Backlog => comfy_table::Cell::new("backlog").fg(comfy_table::Color::from(super::priority::BACKLOG)), Low => comfy_table::Cell::new("low").fg(comfy_table::Color::from(super::priority::LOW)), Medium => comfy_table::Cell::new("medium").fg(comfy_table::Color::from(super::priority::MEDIUM)), High => comfy_table::Cell::new("high").fg(comfy_table::Color::from(super::priority::HIGH)), diff --git a/src/tasks.rs b/src/tasks.rs index 378f018..e757bb5 100755 --- a/src/tasks.rs +++ b/src/tasks.rs @@ -23,6 +23,7 @@ pub struct Task { #[derive(Default, Debug, Clone, Hash, PartialEq, Eq, PartialOrd, Ord, clap::ValueEnum, serde::Serialize, serde::Deserialize)] pub enum Priority { + Backlog, #[default] Low, Medium, @@ -637,15 +638,4 @@ impl fmt::Display for Duration { } } -impl fmt::Display for Priority { - fn fmt(&self, f : &mut fmt::Formatter<'_>) -> fmt::Result { - use Priority::*; - let priority = match self { - Low => "low", - Medium => "medium", - High => "high", - }; - write!(f, "{}", priority) - } -}