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

cli: colorize only "Error: "/"Warning: "/"Hint: " headings

I think long message is easier to read if printed in the default color. Errors
and warnings are printed in bold to make them distinct.
This commit is contained in:
Yuya Nishihara 2024-03-24 16:03:00 +09:00
parent 078acc9eee
commit 195e788f92
2 changed files with 11 additions and 11 deletions

View file

@ -1,10 +1,10 @@
[colors]
"error" = "red"
"warning" = "yellow"
"hint" = "cyan"
"error heading" = { bold = true }
"warning heading" = { bold = true }
"hint heading" = { bold = true }
"error" = { fg = "default", bold = true }
"warning" = { fg = "default", bold = true }
"hint" = { fg = "default" }
"error heading" = { fg = "red", bold = true }
"warning heading" = { fg = "yellow", bold = true }
"hint heading" = { fg = "cyan", bold = true }
"conflict_description" = "yellow"
"conflict_description difficult" = "red"

View file

@ -395,15 +395,15 @@ fn test_color_ui_messages() {
// hint and error
let stderr = test_env.jj_cmd_failure(test_env.env_root(), &["-R."]);
insta::assert_snapshot!(stderr, @r###"
Hint: Use `jj -h` for a list of available commands.
Run `jj config set --user ui.default-command log` to disable this message.
Error: There is no jj repo in "."
Hint: Use `jj -h` for a list of available commands.
Run `jj config set --user ui.default-command log` to disable this message.
Error: There is no jj repo in "."
"###);
// warning
let (_stdout, stderr) = test_env.jj_cmd_ok(&repo_path, &["log", "@"]);
insta::assert_snapshot!(stderr, @r###"
Warning: The argument "@" is being interpreted as a path. To specify a revset, pass -r "@" instead.
Warning: The argument "@" is being interpreted as a path. To specify a revset, pass -r "@" instead.
"###);
// error inlined in template output
@ -419,7 +419,7 @@ fn test_color_ui_messages() {
);
insta::assert_snapshot!(stdout, @r###"
8bb159bc30a9859930e567eb9238a7c43ee6744d
<Error: No commit available> (elided revisions)
<Error: No commit available> (elided revisions)
0000000000000000000000000000000000000000
"###);
}