From 3d826c5407c7e15f67d06f99079c8dde0d5174b8 Mon Sep 17 00:00:00 2001 From: Rootiest Date: Mon, 7 Sep 2026 20:07:25 -0400 Subject: [PATCH] feat(help): header-driven --help for terminal and session functions spwin, tab, hist, bkg, wake-lock and fc take the standard first-arg-only call site, so `wake-lock rsync --help` still runs rsync. split takes --help only: its own ARGUMENTS documents -h as --horizontal, so a literal test replaces the renderer's own flag check. Verified that `split -h` still selects a horizontal split and never prints help. --- functions/bkg.fish | 2 ++ functions/fc.fish | 2 ++ functions/hist.fish | 2 ++ functions/split.fish | 4 ++++ functions/spwin.fish | 2 ++ functions/tab.fish | 2 ++ functions/wake-lock.fish | 2 ++ 7 files changed, 16 insertions(+) diff --git a/functions/bkg.fish b/functions/bkg.fish index 4cd5f03..517dd27 100644 --- a/functions/bkg.fish +++ b/functions/bkg.fish @@ -23,6 +23,8 @@ # EXAMPLE # bkg firefox function bkg --description 'Execute bkg' + __fish_help_header (status current-function) $argv; and return 0 + # Check if a command was provided as an argument. if test -z "$argv[1]" set -l c_head (set_color --bold cyan) diff --git a/functions/fc.fish b/functions/fc.fish index 5abb0a1..a65e230 100644 --- a/functions/fc.fish +++ b/functions/fc.fish @@ -24,6 +24,8 @@ # fc # fc git function fc --description 'Edit and execute the last command (Bash-style fc)' + __fish_help_header (status current-function) $argv; and return 0 + set -l tmpfile (mktemp /tmp/fish_fc.XXXXXX).fish if count $argv >/dev/null diff --git a/functions/hist.fish b/functions/hist.fish index b21c97c..4536efa 100644 --- a/functions/hist.fish +++ b/functions/hist.fish @@ -17,6 +17,8 @@ # EXAMPLE # hist function hist --description 'Search fish history and put it in the prompt' + __fish_help_header (status current-function) $argv; and return 0 + # Opinionated guard (C4): integrations disabled if not __fish_config_op_enabled (status current-function) set -l c_err (set_color red) diff --git a/functions/split.fish b/functions/split.fish index 618b42a..32b2695 100644 --- a/functions/split.fish +++ b/functions/split.fish @@ -29,6 +29,10 @@ # split # split -v nvim README.md function split --description 'Run a command in a new terminal split' + # -h is --horizontal here (see this function's own ARGUMENTS), + # so only the long form may reach the renderer. + test "$argv[1]" = --help; and __fish_help_header (status current-function) --help; and return 0 + # Opinionated guard (C4): integrations disabled if not __fish_config_op_enabled (status current-function) set -l c_err (set_color red) diff --git a/functions/spwin.fish b/functions/spwin.fish index 18fb036..9068790 100644 --- a/functions/spwin.fish +++ b/functions/spwin.fish @@ -24,6 +24,8 @@ # EXAMPLE # spwin function spwin --wraps='~/.config/kitty/spawn-window.sh' --description 'spawn window in kitty or wezterm' + __fish_help_header (status current-function) $argv; and return 0 + # Opinionated guard (C4): integrations disabled if not __fish_config_op_enabled (status current-function) set -l c_err (set_color red) diff --git a/functions/tab.fish b/functions/tab.fish index 6cb9c21..6590dce 100644 --- a/functions/tab.fish +++ b/functions/tab.fish @@ -25,6 +25,8 @@ # EXAMPLE # tab function tab --description 'Spawn a new tab in the current terminal' + __fish_help_header (status current-function) $argv; and return 0 + # Opinionated guard (C4): integrations disabled if not __fish_config_op_enabled (status current-function) set -l c_err (set_color red) diff --git a/functions/wake-lock.fish b/functions/wake-lock.fish index 053556e..1c55ee8 100644 --- a/functions/wake-lock.fish +++ b/functions/wake-lock.fish @@ -22,6 +22,8 @@ # EXAMPLE # wake-lock rsync -avz src/ dest/ function wake-lock --description 'Run a command while inhibiting system sleep' + __fish_help_header (status current-function) $argv; and return 0 + if test (count $argv) -eq 0 set -l c_head (set_color --bold cyan) set -l c_cmd (set_color --bold)