ok/jj
1
0
Fork 0
forked from mirrors/jj

cli: use bright colors for head of operation log

This commit is contained in:
Martin von Zweigbergk 2021-10-27 16:09:05 -07:00
parent 922fea0c18
commit 3981cd90f8
2 changed files with 17 additions and 2 deletions

View file

@ -3216,9 +3216,10 @@ fn cmd_op_log(
formatter.write_str(&metadata.description)?;
formatter.remove_label()?;
for (key, value) in &metadata.tags {
formatter.add_label("tags".to_string())?;
formatter.write_str(&format!("\n{}: {}", key, value))?;
formatter.remove_label()?;
}
Ok(())
}
}
@ -3234,18 +3235,25 @@ fn cmd_op_log(
for parent in op.parents() {
edges.push(Edge::direct(parent.id().clone()));
}
let is_head_op = op.id() == &head_op_id;
let mut buffer = vec![];
{
let writer = Box::new(&mut buffer);
let mut formatter = ui.new_formatter(writer);
formatter.add_label("op-log".to_string())?;
if is_head_op {
formatter.add_label("head".to_string())?;
}
template.format(&op, formatter.as_mut())?;
if is_head_op {
formatter.remove_label()?;
}
formatter.remove_label()?;
}
if !buffer.ends_with(b"\n") {
buffer.push(b'\n');
}
let node_symbol = if op.id() == &head_op_id { b"@" } else { b"o" };
let node_symbol = if is_head_op { b"@" } else { b"o" };
graph.add_node(op.id(), &edges, node_symbol, &buffer)?;
}

View file

@ -169,6 +169,13 @@ fn config_colors(user_settings: &UserSettings) -> HashMap<String, String> {
result.insert(String::from("op-log id"), String::from("blue"));
result.insert(String::from("op-log user"), String::from("yellow"));
result.insert(String::from("op-log time"), String::from("magenta"));
result.insert(String::from("op-log tags"), String::from("white"));
result.insert(String::from("op-log head id"), String::from("bright blue"));
result.insert(String::from("op-log head user"), String::from("bright yellow"));
result.insert(String::from("op-log head time"), String::from("bright magenta"));
result.insert(String::from("op-log head description"), String::from("bright white"));
result.insert(String::from("op-log head tags"), String::from("bright white"));
result.insert(String::from("concepts heading"), String::from("yellow"));