feat: default to 'show' subcommand when jjf is invoked without args
Mirrors the original bash+fzf script's behavior — `jjf` alone becomes a quick rev browser. Implemented in shell wrappers (so the --emit history-rewrite path still applies); the binary itself still prints usage on bare invocation, for explicit invocations.
This commit is contained in:
4 files changed
+15
-9
No files matched your search
+5
-1
@@ -1,6 +1,10 @@
|
|||||||
jjf() {
|
jjf() {
|
||||||
|
# No args → default to `show` so `jjf` alone is a rev browser.
|
||||||
|
if [ $# -eq 0 ]; then
|
||||||
|
set -- show
|
||||||
|
fi
|
||||||
# Meta-commands and bare flags bypass the picker and run the binary directly.
|
# Meta-commands and bare flags bypass the picker and run the binary directly.
|
||||||
if [ $# -eq 0 ] || [ "$1" = "init" ] || [ "${1#-}" != "$1" ]; then
|
if [ "$1" = "init" ] || [ "${1#-}" != "$1" ]; then
|
||||||
command jjf "$@"
|
command jjf "$@"
|
||||||
return $?
|
return $?
|
||||||
fi
|
fi
|
||||||
|
|||||||
+3
-3
@@ -1,10 +1,10 @@
|
|||||||
function jjf
|
function jjf
|
||||||
set -e _jjf_pending_swap
|
set -e _jjf_pending_swap
|
||||||
# Meta-commands and bare flags bypass the picker and run the binary directly.
|
# No args → default to `show` so `jjf` alone is a rev browser.
|
||||||
if test (count $argv) -eq 0
|
if test (count $argv) -eq 0
|
||||||
command jjf
|
set argv show
|
||||||
return $status
|
|
||||||
end
|
end
|
||||||
|
# Meta-commands and bare flags bypass the picker and run the binary directly.
|
||||||
if test "$argv[1]" = init; or string match -q -- '-*' $argv[1]
|
if test "$argv[1]" = init; or string match -q -- '-*' $argv[1]
|
||||||
command jjf $argv
|
command jjf $argv
|
||||||
return $status
|
return $status
|
||||||
|
|||||||
+2
-4
@@ -1,9 +1,7 @@
|
|||||||
def --env jjf [...args] {
|
def --env jjf [...args] {
|
||||||
|
# No args → default to `show` so `jjf` alone is a rev browser.
|
||||||
|
let args = if ($args | is-empty) { ["show"] } else { $args }
|
||||||
# Meta-commands and bare flags bypass the picker and run the binary directly.
|
# Meta-commands and bare flags bypass the picker and run the binary directly.
|
||||||
if ($args | is-empty) {
|
|
||||||
^jjf
|
|
||||||
return
|
|
||||||
}
|
|
||||||
let first = $args.0
|
let first = $args.0
|
||||||
if $first == "init" or ($first | str starts-with "-") {
|
if $first == "init" or ($first | str starts-with "-") {
|
||||||
^jjf ...$args
|
^jjf ...$args
|
||||||
|
|||||||
+5
-1
@@ -1,6 +1,10 @@
|
|||||||
jjf() {
|
jjf() {
|
||||||
|
# No args → default to `show` so `jjf` alone is a rev browser.
|
||||||
|
if [ $# -eq 0 ]; then
|
||||||
|
set -- show
|
||||||
|
fi
|
||||||
# Meta-commands and bare flags bypass the picker and run the binary directly.
|
# Meta-commands and bare flags bypass the picker and run the binary directly.
|
||||||
if [ $# -eq 0 ] || [ "$1" = "init" ] || [ "${1#-}" != "$1" ]; then
|
if [ "$1" = "init" ] || [ "${1#-}" != "$1" ]; then
|
||||||
command jjf "$@"
|
command jjf "$@"
|
||||||
return $?
|
return $?
|
||||||
fi
|
fi
|
||||||
|
|||||||
Reference in new issue
Block a user