mirror of
https://github.com/martinvonz/jj.git
synced 2024-12-28 15:34:22 +00:00
config: extract "show" template to config/templates.toml
Aside from [template] vs [templates], we might want a "show" template alias so "jj log -Tshow" serves the role of "hg log -v".
This commit is contained in:
parent
a5a49c8c12
commit
32f4a81329
2 changed files with 14 additions and 11 deletions
|
@ -1278,17 +1278,8 @@ fn cmd_diff(ui: &mut Ui, command: &CommandHelper, args: &DiffArgs) -> Result<(),
|
|||
fn cmd_show(ui: &mut Ui, command: &CommandHelper, args: &ShowArgs) -> Result<(), CommandError> {
|
||||
let workspace_command = command.workspace_helper(ui)?;
|
||||
let commit = workspace_command.resolve_single_rev(&args.revision)?;
|
||||
// TODO: Add branches, tags, etc
|
||||
// TODO: Indent the description like Git does
|
||||
let template_string = r#"
|
||||
"Commit ID: " commit_id "\n"
|
||||
"Change ID: " change_id "\n"
|
||||
"Author: " author " (" format_timestamp(author.timestamp()) ")\n"
|
||||
"Committer: " committer " (" format_timestamp(committer.timestamp()) ")\n"
|
||||
"\n"
|
||||
if(description, description, description_placeholder "\n")
|
||||
"\n""#;
|
||||
let template = workspace_command.parse_commit_template(template_string)?;
|
||||
let template_string = command.settings().config().get_string("template.show")?;
|
||||
let template = workspace_command.parse_commit_template(&template_string)?;
|
||||
ui.request_pager();
|
||||
let mut formatter = ui.stdout_formatter();
|
||||
let formatter = formatter.as_mut();
|
||||
|
|
|
@ -23,5 +23,17 @@ label(if(current_working_copy, "working_copy"),
|
|||
)
|
||||
'''
|
||||
|
||||
# TODO: Add branches, tags, etc
|
||||
# TODO: Indent the description like Git does
|
||||
show = '''
|
||||
"Commit ID: " commit_id "\n"
|
||||
"Change ID: " change_id "\n"
|
||||
"Author: " author " (" format_timestamp(author.timestamp()) ")\n"
|
||||
"Committer: " committer " (" format_timestamp(committer.timestamp()) ")\n"
|
||||
"\n"
|
||||
if(description, description, description_placeholder "\n")
|
||||
"\n"
|
||||
'''
|
||||
|
||||
[template-aliases]
|
||||
'description_placeholder' = 'label("description", "(no description set)")'
|
||||
|
|
Loading…
Reference in a new issue