templates: colorize description_placeholder

Also, see https://github.com/martinvonz/jj/pull/2100.
This commit is contained in:
Vamsi Avula 2023-08-24 09:56:45 +05:30
parent 38c362bd53
commit 89b7b0bfe8
3 changed files with 9 additions and 4 deletions

View file

@ -32,6 +32,8 @@
"divergent change_id"="red"
"conflict" = "red"
"empty" = "green"
"description placeholder" = "yellow"
"empty description placeholder" = "green"
"separator" = "bright black"
"root" = "green"
@ -51,6 +53,8 @@
"working_copy divergent change_id" = "bright red"
"working_copy conflict" = "bright red"
"working_copy empty" = "bright green"
"working_copy description placeholder" = "yellow"
"working_copy empty description placeholder" = "bright green"
"diff header" = "yellow"
"diff empty" = "cyan"
"diff file_header" = { bold = true }

View file

@ -121,7 +121,8 @@ separate(" ",
)
'''
description_placeholder = 'label("description placeholder", "(no description set)")'
description_placeholder = '''
label(if(empty, "empty ") ++ "description placeholder", "(no description set)")'''
commit_summary_separator = 'label("separator", " | ")'
# Hook points for users to customize the default templates:

View file

@ -266,9 +266,9 @@ fn test_log_obslog_divergence() {
@ qpvuntsm?? test.user@example.com 2001-02-03 04:05:08.000 +07:00 7a17d52e
description 1
qpvuntsm?? hidden test.user@example.com 2001-02-03 04:05:08.000 +07:00 3b68ce25
(no description set)
(no description set)
qpvuntsm?? hidden test.user@example.com 2001-02-03 04:05:07.000 +07:00 230dd059
(empty) (no description set)
(empty) (no description set)
"###);
}
@ -286,7 +286,7 @@ fn test_log_git_head() {
@ rlvkpnrz test.user@example.com 2001-02-03 04:05:09.000 +07:00 50aaf475
initial
qpvuntsm test.user@example.com 2001-02-03 04:05:07.000 +07:00 master HEAD@git 230dd059
(empty) (no description set)
(empty) (no description set)
zzzzzzzz root 00000000
"###);
}