PR #168's Notes section named several functions with a real external-tool dependency that no `type -q`/`command -q`/`command -v`/ `which` guard covers anywhere in the tree, deliberately left out of DEPENDENCIES to avoid breaking test_dependencies_resolve. Adds the guard each was missing, then declares the dependency now that it resolves: - bkg, detach: nohup - gitui: gitui (self-shadow; type -q -f to skip the function itself) - play-media: mpv, vlc -- already guarded via `type -q -f $p` in a loop, just never recognized as one (see next point) - steam-dl: systemd-inhibit, steam - wake-lock: systemd-inhibit - split, spwin, tab: wezterm, konsole (kitty already declared) docs/verify-manual.py's guard-detection regex only matched `type -q <name>` immediately, so `type -q -f $p` (the `-f` flag excludes functions from the match, needed wherever a wrapper shadows a binary of its own name) was invisible to it -- both as a direct guard and through the loop-variable indirection. Broadened both patterns to skip over any flags between `-q` and the name/variable. split/spwin/tab dispatch on $TERM/$TERM_PROGRAM/$KONSOLE_VERSION to pick which terminal-specific binary to call, per this repo's C4 convention -- but those env vars only prove the terminal type, not that its CLI binary is on $PATH: they propagate over ssh, so sshing out from Kitty/WezTerm inherits the var on a remote host that never installed the binary. Same latent gap in clone/clonet, whose clone-in-kitty is a function Kitty's own shell integration injects, not present on a remote shell that only inherited $TERM. All five now check the actual thing they are about to call, not just the env var that selects it. Also guards and documents three more real, previously-undeclared dependencies found by the same audit, unrelated to PR #168's named list but the identical pattern: fast-cli (fast), lock (loginctl), ports (lsof), screensleep (busctl). docs/fish-config.md regenerated to match.
62 lines
1.9 KiB
Fish
62 lines
1.9 KiB
Fish
# Copyright (C) 2026 Rootiest
|
|
# SPDX-License-Identifier: AGPL-3.0-or-later
|
|
|
|
# CATEGORY
|
|
# 08-terminal-management
|
|
#
|
|
# COMPONENT
|
|
# integrations/window-mgmt
|
|
#
|
|
# DEPENDENCIES
|
|
# kitty, wezterm
|
|
#
|
|
# SYNOPSIS
|
|
# spwin [args...]
|
|
#
|
|
# DESCRIPTION
|
|
# Spawns a new terminal OS window in Kitty (via spawn-window.sh if
|
|
# present, otherwise kitty @ launch) or WezTerm (via wezterm cli spawn).
|
|
#
|
|
# ARGUMENTS
|
|
# args... Arguments forwarded to the spawn command
|
|
#
|
|
# EXIT STATUS
|
|
# 0 Window opened successfully
|
|
# 1 Not running inside Kitty or WezTerm
|
|
#
|
|
# 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)
|
|
__fish_palette
|
|
echo "$c_err"'spwin: disabled by __fish_config_op_integrations'"$c_reset" >&2
|
|
return 1
|
|
end
|
|
|
|
# $TERM/$TERM_PROGRAM only prove the terminal type, not that its CLI
|
|
# binary is on $PATH -- e.g. sshing out from Kitty/WezTerm inherits the
|
|
# env var on the remote host without the binary. Check explicitly.
|
|
if test "$TERM" = xterm-kitty
|
|
if test -x ~/.config/kitty/spawn-window.sh
|
|
~/.config/kitty/spawn-window.sh $argv
|
|
else if type -q kitty
|
|
kitty @ launch --type=window $argv
|
|
else
|
|
echo "Error: 'spwin' detected Kitty but neither spawn-window.sh nor the kitty binary is available." >&2
|
|
return 1
|
|
end
|
|
else if test "$TERM_PROGRAM" = WezTerm
|
|
if not type -q wezterm
|
|
echo "Error: 'spwin' detected WezTerm but the wezterm binary is not installed." >&2
|
|
return 1
|
|
end
|
|
wezterm cli spawn $argv
|
|
else
|
|
echo "Error: The 'spwin' command requires Kitty or WezTerm." >&2
|
|
return 1
|
|
end
|
|
end
|