cli: label log/obslog template as "log"

It was removed at 522025e091 "log: remove unused and inconsistent `log`
label", but obslog had the same inconsistency. Since it's now easy to label
the template output, let's re-add the "log" label.

The change in test_templater_upper_lower() is noop. Formatter no longer
emits reset sequence in the middle because the template is still labeled.
This commit is contained in:
Yuya Nishihara 2024-04-16 16:38:38 +09:00
parent 6da9167585
commit 1b3bcedd53
3 changed files with 15 additions and 12 deletions

View file

@ -119,11 +119,13 @@ pub(crate) fn cmd_log(
Some(value) => value.to_string(),
None => command.settings().config().get_string("templates.log")?,
};
template = workspace_command.parse_template(
template = workspace_command
.parse_template(
&language,
&template_string,
CommitTemplateLanguage::wrap_commit,
)?;
)?
.labeled("log");
node_template = workspace_command
.parse_template(
&language,

View file

@ -79,11 +79,13 @@ pub(crate) fn cmd_obslog(
Some(value) => value.to_string(),
None => command.settings().config().get_string("templates.log")?,
};
template = workspace_command.parse_template(
template = workspace_command
.parse_template(
&language,
&template_string,
CommitTemplateLanguage::wrap_commit,
)?;
)?
.labeled("log");
node_template = workspace_command
.parse_template(
&language,
@ -96,7 +98,6 @@ pub(crate) fn cmd_obslog(
ui.request_pager();
let mut formatter = ui.stdout_formatter();
let formatter = formatter.as_mut();
formatter.push_label("log")?;
let mut commits = topo_order_reverse(
vec![start_commit],

View file

@ -124,7 +124,7 @@ fn test_templater_upper_lower() {
insta::assert_snapshot!(
render(r#"change_id.shortest(4).upper() ++ change_id.shortest(4).upper().lower()"#),
@"ZZZZzzzz");
@"ZZZZzzzz");
insta::assert_snapshot!(
render(r#""Hello".upper() ++ "Hello".lower()"#), @"HELLOhello");
}