From b8f8827914ac0c02048d43265ff87aa434ca6b28 Mon Sep 17 00:00:00 2001 From: Yuya Nishihara Date: Sat, 21 Sep 2024 22:16:21 +0900 Subject: [PATCH] docs: add some scripting template examples Closes #4357 --- docs/templates.md | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/docs/templates.md b/docs/templates.md index 5fef4ea1f..3925534f8 100644 --- a/docs/templates.md +++ b/docs/templates.md @@ -303,3 +303,17 @@ concat( ''' 'format_field(key, value)' = 'key ++ ": " ++ value ++ "\n"' ``` + +## Examples + +Get short commit IDs of the working-copy parents: + +```sh +jj log --no-graph -r @ -T 'parents.map(|c| c.commit_id().short()).join(",")' +``` + +Show machine-readable list of full commit and change IDs: + +```sh +jj log --no-graph -T 'commit_id ++ " " ++ change_id ++ "\n"' +```