2024-11-19 16:43:29 +08:00
|
|
|
|
function fish_jj_prompt
|
2025-01-03 12:38:14 +08:00
|
|
|
|
# If jj isn't installed, there's nothing we can do
|
|
|
|
|
# Return 1 so the calling prompt can deal with it
|
|
|
|
|
if not command -sq jj
|
|
|
|
|
return 1
|
|
|
|
|
end
|
2025-01-12 18:14:26 +08:00
|
|
|
|
set -l info "$(
|
|
|
|
|
jj log 2>/dev/null --no-graph --ignore-working-copy --color=always --revisions @ \
|
|
|
|
|
--template '
|
2024-11-19 16:43:29 +08:00
|
|
|
|
separate(" ",
|
|
|
|
|
bookmarks,
|
|
|
|
|
tags,
|
|
|
|
|
if(conflict, label("conflict", "×")),
|
|
|
|
|
if(empty, label("empty", "(empty)"))
|
2025-01-12 18:14:26 +08:00
|
|
|
|
)
|
|
|
|
|
'
|
|
|
|
|
)"
|
2025-01-13 21:54:00 +08:00
|
|
|
|
or return 1
|
|
|
|
|
if test -n "$info"
|
2025-01-12 18:14:26 +08:00
|
|
|
|
printf ' %s' $info
|
|
|
|
|
end
|
2024-11-19 16:43:29 +08:00
|
|
|
|
end
|