urgency
This commit is contained in:
parent
aa6a531616
commit
bf2f7a28eb
25
src/main.rs
25
src/main.rs
@ -40,6 +40,7 @@ struct Env {
|
|||||||
flags: Flags,
|
flags: Flags,
|
||||||
title: Option<String>,
|
title: Option<String>,
|
||||||
tags: HashMap<String, u32>,
|
tags: HashMap<String, u32>,
|
||||||
|
urgency: HashMap<String, u32>,
|
||||||
viewstag: HashMap<String, Vec<u32>>,
|
viewstag: HashMap<String, Vec<u32>>,
|
||||||
status_manager: Option<Main<ZriverStatusManagerV1>>,
|
status_manager: Option<Main<ZriverStatusManagerV1>>,
|
||||||
}
|
}
|
||||||
@ -50,6 +51,7 @@ impl Env {
|
|||||||
title: None,
|
title: None,
|
||||||
flags: configuration(),
|
flags: configuration(),
|
||||||
viewstag: HashMap::new(),
|
viewstag: HashMap::new(),
|
||||||
|
urgency: HashMap::new(),
|
||||||
tags: HashMap::new(),
|
tags: HashMap::new(),
|
||||||
status_manager: None,
|
status_manager: None,
|
||||||
}
|
}
|
||||||
@ -75,6 +77,7 @@ impl Env {
|
|||||||
fn fmt(&self) {
|
fn fmt(&self) {
|
||||||
if !self.tags.is_empty()
|
if !self.tags.is_empty()
|
||||||
|| !self.viewstag.is_empty()
|
|| !self.viewstag.is_empty()
|
||||||
|
|| !self.urgency.is_empty()
|
||||||
|| self.title.is_some() {
|
|| self.title.is_some() {
|
||||||
print!("{{");
|
print!("{{");
|
||||||
let mut comma = false;
|
let mut comma = false;
|
||||||
@ -91,6 +94,19 @@ impl Env {
|
|||||||
print!("]");
|
print!("]");
|
||||||
comma = true;
|
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 !self.viewstag.is_empty() {
|
||||||
if comma { print!(", "); }
|
if comma { print!(", "); }
|
||||||
print!("\"viewstag\" : [");
|
print!("\"viewstag\" : [");
|
||||||
@ -222,10 +238,11 @@ fn main() {
|
|||||||
tags,
|
tags,
|
||||||
} => {
|
} => {
|
||||||
if env.flags.urgency {
|
if env.flags.urgency {
|
||||||
env.set_value(
|
if let Some(inner_value) = env.urgency.get_mut(&make) {
|
||||||
&make,
|
(*inner_value) = tags;
|
||||||
Value::Tags(tags),
|
} else {
|
||||||
);
|
env.urgency.insert(make.clone(), tags);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user