Skip to content

Commit

Permalink
Add template aliases with node symbol configs.
Browse files Browse the repository at this point in the history
  • Loading branch information
algmyr committed Apr 14, 2024
1 parent 57a5d7d commit e129fb3
Show file tree
Hide file tree
Showing 7 changed files with 88 additions and 1 deletion.
8 changes: 8 additions & 0 deletions cli/src/config/colors.toml
Original file line number Diff line number Diff line change
Expand Up @@ -87,3 +87,11 @@
"op_log current_operation id" = "bright blue"
"op_log current_operation user" = "yellow" # No bright yellow, see comment above
"op_log current_operation time" = "bright cyan"

"node" = { bold = true }
"node elided" = { fg = "bright black" }
"node working_copy" = { fg = "green" }
"node current_operation" = { fg = "green" }
"node immutable" = { fg = "bright cyan" }
"node conflict" = { fg = "red" }
"node normal" = { bold = false }
63 changes: 63 additions & 0 deletions cli/src/config/templates.toml
Original file line number Diff line number Diff line change
Expand Up @@ -165,3 +165,66 @@ if(hidden,
)
)
'''

'label_log_node(content)' = '''
label("node",
coalesce(
if(!self, label("elided", content)),
if(immutable, label("immutable", content)),
if(conflict, label("conflict", content)),
if(current_working_copy, label("working_copy", content)),
label("normal", content),
)
)
'''

'label_op_log_node(content)' = '''
label("node",
coalesce(
if(current_operation, label("current_operation", content)),
label("normal", content),
)
)
'''

builtin_log_node = '''
label_log_node(
coalesce(
if(!self, "~"),
if(current_working_copy, "@"),
if(immutable, "◆"),
if(conflict, "×"),
"○",
)
)
'''

builtin_log_node_ascii = '''
label_log_node(
coalesce(
if(!self, "~"),
if(current_working_copy, "@"),
if(immutable, "#"),
if(conflict, "x"),
"o",
)
)
'''

builtin_op_log_node = '''
label_op_log_node(
coalesce(
if(current_operation, "@"),
"○",
)
)
'''

builtin_op_log_node_ascii = '''
label_op_log_node(
coalesce(
if(current_operation, "@"),
"o",
)
)
'''
4 changes: 4 additions & 0 deletions cli/tests/test_log_command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,13 @@ fn test_log_with_no_template() {
- builtin_log_comfortable
- builtin_log_compact
- builtin_log_detailed
- builtin_log_node
- builtin_log_node_ascii
- builtin_log_oneline
- builtin_op_log_comfortable
- builtin_op_log_compact
- builtin_op_log_node
- builtin_op_log_node_ascii
- commit_summary_separator
- description_placeholder
- email_placeholder
Expand Down
4 changes: 4 additions & 0 deletions cli/tests/test_obslog_command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -279,9 +279,13 @@ fn test_obslog_with_no_template() {
- builtin_log_comfortable
- builtin_log_compact
- builtin_log_detailed
- builtin_log_node
- builtin_log_node_ascii
- builtin_log_oneline
- builtin_op_log_comfortable
- builtin_op_log_compact
- builtin_op_log_node
- builtin_op_log_node_ascii
- commit_summary_separator
- description_placeholder
- email_placeholder
Expand Down
4 changes: 4 additions & 0 deletions cli/tests/test_operations.rs
Original file line number Diff line number Diff line change
Expand Up @@ -140,9 +140,13 @@ fn test_op_log_with_no_template() {
- builtin_log_comfortable
- builtin_log_compact
- builtin_log_detailed
- builtin_log_node
- builtin_log_node_ascii
- builtin_log_oneline
- builtin_op_log_comfortable
- builtin_op_log_compact
- builtin_op_log_node
- builtin_op_log_node_ascii
- commit_summary_separator
- description_placeholder
- email_placeholder
Expand Down
4 changes: 4 additions & 0 deletions cli/tests/test_show_command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,13 @@ fn test_show_with_no_template() {
- builtin_log_comfortable
- builtin_log_compact
- builtin_log_detailed
- builtin_log_node
- builtin_log_node_ascii
- builtin_log_oneline
- builtin_op_log_comfortable
- builtin_op_log_compact
- builtin_op_log_node
- builtin_op_log_node_ascii
- commit_summary_separator
- description_placeholder
- email_placeholder
Expand Down
2 changes: 1 addition & 1 deletion cli/tests/test_templater.rs
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ fn test_templater_parse_error() {
| ^-----^
|
= Keyword "builtin" doesn't exist
Hint: Did you mean "builtin_change_id_with_hidden_and_divergent_info", "builtin_log_comfortable", "builtin_log_compact", "builtin_log_detailed", "builtin_log_oneline", "builtin_op_log_comfortable", "builtin_op_log_compact"?
Hint: Did you mean "builtin_change_id_with_hidden_and_divergent_info", "builtin_log_comfortable", "builtin_log_compact", "builtin_log_detailed", "builtin_log_node", "builtin_log_node_ascii", "builtin_log_oneline", "builtin_op_log_comfortable", "builtin_op_log_compact", "builtin_op_log_node", "builtin_op_log_node_ascii"?
"###);
}

Expand Down

0 comments on commit e129fb3

Please sign in to comment.