Last active
April 22, 2025 18:24
-
-
Save cole-h/8257cce65264c49669c47d6f63286821 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function fish_jj_prompt --description 'Write out the jj prompt' | |
# Is jj installed? | |
if not command -sq jj | |
return 1 | |
end | |
# Are we in a jj repo? | |
if not jj root &>/dev/null | |
return 1 | |
end | |
# Generate prompt | |
set -l info "$( | |
set -l op_id (jj op log --ignore-working-copy --no-graph --limit=1 --template 'self.id().short()') | |
jj log --ignore-working-copy --no-graph --color=always --revisions=@ --template " | |
separate( | |
' ', | |
label('operation id', '$op_id'), | |
bookmarks.join(', '), | |
if(conflict, label('conflict', '×')), | |
if(empty, label('empty', '(empty)')), | |
if(divergent, label('divergent', '(divergent)')), | |
if(hidden, label('hidden', '(hidden)')), | |
) | |
" | |
)" | |
or return 1 | |
if test -n $info | |
printf ' (%s)' $info | |
else | |
return 1 | |
end | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
vin@scadrial ~/w/v/jj (e802e0d6bd4c (empty)) 08:10:06 08 Apr 2025 0ms | |
> # hi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment