refactor: use __fish_palette in system and package functions

44 duplicated declarations replaced by 8 calls. Output strings untouched.

fish-deps, upgrade and wake-lock have no --help path and are deliberately
NOT added to the harness case list -- upgrade and wake-lock have side
effects, and runtime coverage is not worth mutating state during tests.
They are covered by --structural, which proves mechanically that no
rendering line changed.
This commit is contained in:
2026-09-07 20:05:23 -04:00
parent 29afe5c89f
commit b0c6d7f7f5
8 changed files with 8 additions and 44 deletions
+1 -5
View File
@@ -30,11 +30,7 @@ function dockup --description 'Pull and restart docker compose containers'
# Handle help flags
if contains -- -h $argv; or contains -- --help $argv
set -l c_head (set_color --bold cyan)
set -l c_cmd (set_color --bold)
set -l c_flag (set_color yellow)
set -l c_dim (set_color brblack)
set -l c_reset (set_color normal)
__fish_palette
echo "$c_head""Usage:$c_reset $c_cmd""dockup$c_reset $c_dim""[DIRECTORY]$c_reset"
echo ""
echo "$c_head""Options:$c_reset"
+1 -5
View File
@@ -93,11 +93,7 @@ end
# EXAMPLE
# __fish_deps_help
function __fish_deps_help
set -l c_head (set_color --bold cyan)
set -l c_cmd (set_color --bold)
set -l c_flag (set_color yellow)
set -l c_dim (set_color brblack)
set -l c_reset (set_color normal)
__fish_palette
echo "$c_head""fish-deps$c_reset — manage fish shell dependencies"
echo ""
+1 -8
View File
@@ -51,14 +51,7 @@
# redirections must be wrapped explicitly, e.g.
# jobrunner run sync fish -c 'a | b'.
function jobrunner --description 'Manage detached background jobs with tmux or GNU screen'
set -l c_head (set_color --bold cyan)
set -l c_cmd (set_color --bold)
set -l c_arg (set_color cyan)
set -l c_flag (set_color yellow)
set -l c_ok (set_color green)
set -l c_err (set_color red)
set -l c_dim (set_color brblack)
set -l c_reset (set_color normal)
__fish_palette
set -l subcmds run list attach kill logs help \
-r --run -l --list -a --attach -k --kill -o --output -h --help
+1 -8
View File
@@ -38,14 +38,7 @@
# kitty-logging install
# kitty-logging status
function kitty-logging --description 'Install/manage the fish-config Kitty scrollback watcher'
set -l c_head (set_color --bold cyan)
set -l c_cmd (set_color --bold)
set -l c_flag (set_color yellow)
set -l c_ok (set_color green)
set -l c_warn (set_color yellow)
set -l c_err (set_color red)
set -l c_dim (set_color brblack)
set -l c_reset (set_color normal)
__fish_palette
set -l cmd $argv[1]
+1 -8
View File
@@ -46,14 +46,7 @@ function pkg --description 'Install or remove packages via the system package ma
end
# ── Colour palette ───────────────────────────────────────────
set -l c_head (set_color --bold cyan)
set -l c_cmd (set_color --bold)
set -l c_flag (set_color yellow)
set -l c_ok (set_color green)
set -l c_warn (set_color yellow)
set -l c_err (set_color red)
set -l c_dim (set_color brblack)
set -l c_reset (set_color normal)
__fish_palette
# ── Installed-check helper ───────────────────────────────────
# Uses only its own arguments — safe to define as an inner function.
+1 -4
View File
@@ -63,10 +63,7 @@ function scrub --description 'Recursively purge OS, editor, and compiler garbage
# Helper function for help menu text
function _scrub_help
set -l c_head (set_color --bold cyan)
set -l c_cmd (set_color --bold)
set -l c_flag (set_color yellow)
set -l c_reset (set_color normal)
__fish_palette
echo "$c_head""Usage:$c_reset $c_cmd""scrub$c_reset $c_flag""[options]$c_reset"
echo
+1 -2
View File
@@ -23,8 +23,7 @@
function upgrade --description 'Full system upgrade via paru or yay'
# Opinionated guard (C4): integrations disabled
if not __fish_config_op_enabled (status current-function)
set -l c_err (set_color red)
set -l c_reset (set_color normal)
__fish_palette
echo "$c_err"'upgrade: disabled by __fish_config_op_integrations'"$c_reset" >&2
return 1
end
+1 -4
View File
@@ -23,10 +23,7 @@
# wake-lock rsync -avz src/ dest/
function wake-lock --description 'Run a command while inhibiting system sleep'
if test (count $argv) -eq 0
set -l c_head (set_color --bold cyan)
set -l c_cmd (set_color --bold)
set -l c_arg (set_color cyan)
set -l c_reset (set_color normal)
__fish_palette
echo "$c_head""Usage:$c_reset $c_cmd""wake-lock$c_reset $c_arg""[command] [args...]$c_reset"
return 1
end