diff --git a/src/main.rs b/src/main.rs index bc02bcb..dd5fea8 100644 --- a/src/main.rs +++ b/src/main.rs @@ -40,6 +40,7 @@ struct Env { flags: Flags, title: Option, tags: HashMap, + urgency: HashMap, viewstag: HashMap>, status_manager: Option>, } @@ -50,6 +51,7 @@ impl Env { title: None, flags: configuration(), viewstag: HashMap::new(), + urgency: HashMap::new(), tags: HashMap::new(), status_manager: None, } @@ -75,6 +77,7 @@ impl Env { fn fmt(&self) { if !self.tags.is_empty() || !self.viewstag.is_empty() + || !self.urgency.is_empty() || self.title.is_some() { print!("{{"); let mut comma = false; @@ -91,6 +94,19 @@ impl Env { print!("]"); comma = true; } + if !self.urgency.is_empty() { + print!("\"urgent\" : ["); + let len = self.urgency.len(); + for (i, (key, tags)) in self.urgency.iter().enumerate() { + print!("{{{:?} : ", key); + print!("["); + fmt_tags(*tags); + print!("]}}"); + if i < len - 1 { print!(", "); } + } + print!("]"); + comma = true; + } if !self.viewstag.is_empty() { if comma { print!(", "); } print!("\"viewstag\" : ["); @@ -222,10 +238,11 @@ fn main() { tags, } => { if env.flags.urgency { - env.set_value( - &make, - Value::Tags(tags), - ); + if let Some(inner_value) = env.urgency.get_mut(&make) { + (*inner_value) = tags; + } else { + env.urgency.insert(make.clone(), tags); + } } } }