feat(cable): enhance repository preview with commit graph and add history action

This commit is contained in:
Prad Nukala committed 2026-10-02 13:07:00 -04:00
1 parent 9971d79c5c
commit ab0aa2a548
3 files changed
+29 -6

No files matched your search

+26 -3
View File
@@ -5,7 +5,7 @@ ghq repositories (plus the chezmoi source tree) and Obsidian vaults, newest
git activity first. Enter prints the directory; the gho shell function (ctrl-o
in fish, zsh and bash) cds into it.
"""
requirements = ["ghq", "fd", "onefetch", "mtime-sort"]
requirements = ["ghq", "fd", "git", "serie", "onefetch", "mtime-sort"]
# Entries are "<name>\t<absolute path>": the name is what you fuzzy-match, the
# path is what enter prints. ctrl-s cycles repos → vaults.
@@ -31,20 +31,35 @@ shell = "bash"
display = "{split:\\t:0}"
output = "{split:\\t:1}"
# Two previews, ctrl-f cycles: commit graph (default), then onefetch. serie
# itself cannot draw here -- it is a fullscreen TUI that paints the graph with
# kitty images and has no print mode -- so ctrl-g (history) opens it.
[preview]
command = '''
command = [
'''
d='{split:\t:1}'
if [ -e "$d/.git" ]; then
git -C "$d" log --graph --all --color=always --date=relative -n 300 \
--format='%C(yellow)%h%C(reset) %C(blue)%<(12,trunc)%ad%C(reset) %s%C(auto)%d' 2>&1
else
eza --tree --level 2 --color=always "$d" 2>/dev/null || ls -la "$d"
fi
''',
'''
d='{split:\t:1}'
if [ -e "$d/.git" ]; then
onefetch --no-art "$d" 2>&1
else
eza --tree --level 2 --color=always "$d" 2>/dev/null || ls -la "$d"
fi
'''
''',
]
shell = "bash"
# ctrl-e (edit) is bound globally in config.toml.
[keybindings]
ctrl-b = "actions:browse"
ctrl-g = "actions:history"
[actions.edit]
description = "Open the repository in nvim"
@@ -58,3 +73,11 @@ description = "Open the repository's web page (gop)"
command = "cd '{split:\\t:1}' && gop >/dev/null 2>&1"
shell = "bash"
mode = "fork"
[actions.history]
description = "Browse the commit graph in serie"
# Fork: quitting serie (q) returns to the picker. /dev/tty for the same reason
# as edit; serie also needs a real tty to detect kitty graphics.
command = "cd '{split:\\t:1}' && [ -e .git ] && serie </dev/tty >/dev/tty"
shell = "bash"
mode = "fork"