feat: initial implementation of jjf
A TUI revision picker for jujutsu (jj). Wraps any jj subcommand with an inline fuzzy-finder over jj log, then forwards the picked revision(s) as -r '<id>' to the underlying jj invocation. Features: - Inline viewport (no full-screen alt-screen takeover) - Smart prefix matching: typing the bold portion of a change ID jumps to that revision instantly - Multi-select via Tab; emitted as -r 'A|B|C' revset union - Preflight detection of subcommands that don't accept -r - Optional shell integration (jjf init <bash|zsh|fish|nu>) that rewrites shell history so up-arrow recalls the resolved jj command Hand-rolled ANSI rendering to /dev/tty; only crossterm, nucleo-matcher, anyhow, and libc as runtime dependencies.
This commit is contained in:
11 files changed
+1325
No files matched your search
@@ -0,0 +1,32 @@
|
||||
function jjf
|
||||
set -e _jjf_pending_swap
|
||||
# Meta-commands and bare flags bypass the picker and run the binary directly.
|
||||
if test (count $argv) -eq 0
|
||||
command jjf
|
||||
return $status
|
||||
end
|
||||
if test "$argv[1]" = init; or string match -q -- '-*' $argv[1]
|
||||
command jjf $argv
|
||||
return $status
|
||||
end
|
||||
set -l _jjf_cmd (command jjf --emit $argv)
|
||||
set -l _jjf_status $status
|
||||
if test $_jjf_status -ne 0
|
||||
return $_jjf_status
|
||||
end
|
||||
if test -z "$_jjf_cmd"
|
||||
return 130
|
||||
end
|
||||
builtin history append -- $_jjf_cmd
|
||||
# Signal the postexec hook to remove the literal `jjf …` entry that fish
|
||||
# is about to record (fish records function invocations *after* return).
|
||||
set -g _jjf_pending_swap 1
|
||||
sh -c $_jjf_cmd
|
||||
end
|
||||
|
||||
function _jjf_postexec --on-event fish_postexec
|
||||
if test "$_jjf_pending_swap" = "1"
|
||||
builtin history delete --exact --case-sensitive -- $argv[1]
|
||||
set -e _jjf_pending_swap
|
||||
end
|
||||
end
|
||||
Reference in new issue
Block a user