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

+2 -2
View File
@@ -1,10 +1,10 @@
{ {
"totalAccepted": 31, "totalAccepted": 41,
"shownMilestones": [ "shownMilestones": [
10, 10,
20 20
], ],
"submissionsSinceLastPrompt": 14, "submissionsSinceLastPrompt": 24,
"windowStartedAt": 1790356839288, "windowStartedAt": 1790356839288,
"lastShownAt": 1790359187702, "lastShownAt": 1790359187702,
"dismissed": true "dismissed": true
+1 -1
View File
@@ -1,5 +1,5 @@
{ {
"lastCheck": 1790784309856, "lastCheck": 1790958825140,
"latestVersion": "3.5.2", "latestVersion": "3.5.2",
"hasBreakingChanges": false "hasBreakingChanges": false
} }
+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 git activity first. Enter prints the directory; the gho shell function (ctrl-o
in fish, zsh and bash) cds into it. 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 # Entries are "<name>\t<absolute path>": the name is what you fuzzy-match, the
# path is what enter prints. ctrl-s cycles repos → vaults. # path is what enter prints. ctrl-s cycles repos → vaults.
@@ -31,20 +31,35 @@ shell = "bash"
display = "{split:\\t:0}" display = "{split:\\t:0}"
output = "{split:\\t:1}" 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] [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}' d='{split:\t:1}'
if [ -e "$d/.git" ]; then if [ -e "$d/.git" ]; then
onefetch --no-art "$d" 2>&1 onefetch --no-art "$d" 2>&1
else else
eza --tree --level 2 --color=always "$d" 2>/dev/null || ls -la "$d" eza --tree --level 2 --color=always "$d" 2>/dev/null || ls -la "$d"
fi fi
''' ''',
]
shell = "bash" shell = "bash"
# ctrl-e (edit) is bound globally in config.toml. # ctrl-e (edit) is bound globally in config.toml.
[keybindings] [keybindings]
ctrl-b = "actions:browse" ctrl-b = "actions:browse"
ctrl-g = "actions:history"
[actions.edit] [actions.edit]
description = "Open the repository in nvim" 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" command = "cd '{split:\\t:1}' && gop >/dev/null 2>&1"
shell = "bash" shell = "bash"
mode = "fork" 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"