refactor: retire drifted palette names in the last five functions

c_rst/c_txt -> c_reset, c_ttl -> c_head, c_bold -> c_cmd, c_primary -> c_arg
across 67 interpolation sites (c_rst 53, c_primary 10, c_bold 2, c_ttl 1,
c_txt 1). Each maps to a variable holding identical bytes, so output is
unchanged. Unlike the 33 structural conversions this edits text that
renders, so it is gated on its own per-file byte-diff against main:

  ok  logs --help         (431 B out, 0 B err)
  ok  mkcd --help         (437 B out, 0 B err)
  ok  qc --help           (936 B out, 0 B err)
  ok  rand_string --help  (883 B out, 0 B err)
  ok  smart_exit --help   (265 B out, 0 B err)
  ok  mkcd                (437 B out, 0 B err)   <- no-args error path

c_accent is deliberately NOT merged into c_ok -- both are (set_color green)
but a role is a semantic slot, not a colour. See JOB-BRIEF-FINDINGS.md.

logs.fish needed two calls (the C4 guard block and the --help block, both at
8-space indentation); it is the only multi-run file in the repository and the
exact trap a depth-deduplicating converter falls into. logs.fish also declared
c_bold without ever interpolating it -- that declaration is simply deleted.
This commit is contained in:
2026-09-07 20:10:43 -04:00
parent d75bf4f1b4
commit 7d815b17e8
5 changed files with 50 additions and 75 deletions
+9 -13
View File
@@ -39,8 +39,7 @@
function logs --description 'Browse terminal log files interactively with fzf' function logs --description 'Browse terminal log files interactively with fzf'
# Opinionated guard (C4): integrations disabled # Opinionated guard (C4): integrations disabled
if not __fish_config_op_enabled (status current-function) if not __fish_config_op_enabled (status current-function)
set -l c_err (set_color red) __fish_palette
set -l c_reset (set_color normal)
echo "$c_err"'logs: disabled by __fish_config_op_integrations'"$c_reset" >&2 echo "$c_err"'logs: disabled by __fish_config_op_integrations'"$c_reset" >&2
return 1 return 1
end end
@@ -50,24 +49,21 @@ function logs --description 'Browse terminal log files interactively with fzf'
or return 1 or return 1
if set -q _flag_help if set -q _flag_help
set -l c_accent (set_color green) __fish_palette
set -l c_primary (set_color cyan) echo "Usage: "$c_accent"logs"$c_reset" ["$c_arg"OPTIONS"$c_reset"]"
set -l c_bold (set_color --bold)
set -l c_reset (set_color normal)
echo "Usage: "$c_accent"logs"$c_reset" ["$c_primary"OPTIONS"$c_reset"]"
echo "" echo ""
echo "Browse and open terminal log files interactively." echo "Browse and open terminal log files interactively."
echo "Logs sorted newest-first. Type to fuzzy-filter by date or category." echo "Logs sorted newest-first. Type to fuzzy-filter by date or category."
echo "" echo ""
echo "Options:" echo "Options:"
echo " "$c_primary"-h, --help"$c_reset" Show this help" echo " "$c_arg"-h, --help"$c_reset" Show this help"
echo " "$c_primary"-c, --category"$c_reset" Limit to one category: scrollback, paru, yay" echo " "$c_arg"-c, --category"$c_reset" Limit to one category: scrollback, paru, yay"
echo "" echo ""
echo "Keys in fzf:" echo "Keys in fzf:"
echo " "$c_primary"Enter"$c_reset" Open in \$PAGER" echo " "$c_arg"Enter"$c_reset" Open in \$PAGER"
echo " "$c_primary"Ctrl-E"$c_reset" Open in \$EDITOR" echo " "$c_arg"Ctrl-E"$c_reset" Open in \$EDITOR"
echo " "$c_primary"Ctrl-D"$c_reset" Delete selected log" echo " "$c_arg"Ctrl-D"$c_reset" Delete selected log"
echo " "$c_primary"Ctrl-C"$c_reset" Quit" echo " "$c_arg"Ctrl-C"$c_reset" Quit"
return 0 return 0
end end
+13 -21
View File
@@ -26,31 +26,23 @@
# mkcd ~/projects/myapp # mkcd ~/projects/myapp
# mkcd ~/projects/newapp/src # mkcd ~/projects/newapp/src
function mkcd --description 'Create a directory (with parents) and cd into it' function mkcd --description 'Create a directory (with parents) and cd into it'
set -l c_head (set_color --bold cyan) __fish_palette
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_warn (set_color yellow)
set -l c_err (set_color red)
set -l c_dim (set_color brblack)
set -l c_rst (set_color normal)
if contains -- -h $argv; or contains -- --help $argv; or test (count $argv) -eq 0 if contains -- -h $argv; or contains -- --help $argv; or test (count $argv) -eq 0
echo "$c_head""Usage:$c_rst $c_cmd""mkcd$c_rst $c_arg""<dir>$c_rst" echo "$c_head""Usage:$c_reset $c_cmd""mkcd$c_reset $c_arg""<dir>$c_reset"
echo echo
echo " Create $c_arg""<dir>$c_rst (including missing parents) and cd into it." echo " Create $c_arg""<dir>$c_reset (including missing parents) and cd into it."
echo echo
echo "$c_head""Arguments:$c_rst" echo "$c_head""Arguments:$c_reset"
echo " $c_arg""<dir>$c_rst Directory to create and enter" echo " $c_arg""<dir>$c_reset Directory to create and enter"
echo echo
echo "$c_head""Flags:$c_rst" echo "$c_head""Flags:$c_reset"
echo " $c_flag-h$c_rst, $c_flag--help$c_rst Show this help message" echo " $c_flag-h$c_reset, $c_flag--help$c_reset Show this help message"
echo " $c_flag-s$c_rst, $c_flag--silent$c_rst Suppress directory creation output" echo " $c_flag-s$c_reset, $c_flag--silent$c_reset Suppress directory creation output"
echo echo
echo "$c_head""Examples:$c_rst" echo "$c_head""Examples:$c_reset"
echo " $c_cmd""mkcd$c_rst $c_arg~/projects/myapp$c_rst" echo " $c_cmd""mkcd$c_reset $c_arg~/projects/myapp$c_reset"
echo " $c_cmd""mkcd$c_rst $c_arg~/projects/myapp$c_rst""$c_dim""; git init$c_rst" echo " $c_cmd""mkcd$c_reset $c_arg~/projects/myapp$c_reset""$c_dim""; git init$c_reset"
return 0 return 0
end end
@@ -77,8 +69,8 @@ function mkcd --description 'Create a directory (with parents) and cd into it'
or return $status or return $status
if test $is_new -eq 1 if test $is_new -eq 1
echo "$c_ok""$c_rst Created and entered $c_arg$dir$c_rst" echo "$c_ok""$c_reset Created and entered $c_arg$dir$c_reset"
else else
echo "$c_warn""$c_rst $c_arg$dir$c_rst already exists — entered" echo "$c_warn""$c_reset $c_arg$dir$c_reset already exists — entered"
end end
end end
+9 -14
View File
@@ -32,26 +32,21 @@
if type -q aichat if type -q aichat
function qc --wraps aichat --description 'Quick-chat wrapper around aichat (cli role)' function qc --wraps aichat --description 'Quick-chat wrapper around aichat (cli role)'
if contains -- -h $argv; or contains -- --help $argv if contains -- -h $argv; or contains -- --help $argv
set -l c_ttl (set_color --bold cyan) __fish_palette
set -l c_cmd (set_color --bold)
set -l c_flag (set_color yellow)
set -l c_txt (set_color normal)
set -l c_dim (set_color brblack)
set -l c_rst (set_color normal)
set -l w 59 set -l w 59
set -l bar (string repeat -n $w) set -l bar (string repeat -n $w)
# Title line, padded to the box width (plain form drives the math). # Title line, padded to the box width (plain form drives the math).
set -l title " qc — quick-chat: a thin aichat wrapper" set -l title " qc — quick-chat: a thin aichat wrapper"
set -l pad (string repeat -n (math $w - (string length -- $title)) ' ') set -l pad (string repeat -n (math $w - (string length -- $title)) ' ')
echo "$c_dim$bar$c_rst" echo "$c_dim$bar$c_reset"
echo "$c_dim$c_rst $c_ttl""qc$c_rst $c_dim$c_rst quick-chat: a thin $c_cmd""aichat$c_rst wrapper$pad$c_dim$c_rst" echo "$c_dim$c_reset $c_head""qc$c_reset $c_dim$c_reset quick-chat: a thin $c_cmd""aichat$c_reset wrapper$pad$c_dim$c_reset"
echo "$c_dim$bar$c_rst" echo "$c_dim$bar$c_reset"
echo " Defaults to the $c_flag'cli'$c_rst role — an AI system prompt tuned" echo " Defaults to the $c_flag'cli'$c_reset role — an AI system prompt tuned"
echo " for concise, $c_txt""terminal-friendly$c_rst output." echo " for concise, $c_reset""terminal-friendly$c_reset output."
echo echo
echo " Accepts every $c_cmd""aichat$c_rst flag; passing $c_flag--role$c_rst/$c_flag-r$c_rst overrides" echo " Accepts every $c_cmd""aichat$c_reset flag; passing $c_flag--role$c_reset/$c_flag-r$c_reset overrides"
echo " the default role. $c_cmd""aichat$c_rst's own help follows:" echo " the default role. $c_cmd""aichat$c_reset's own help follows:"
echo "$c_dim$bar$c_rst" echo "$c_dim$bar$c_reset"
aichat --help | string replace -a aichat qc aichat --help | string replace -a aichat qc
return 0 return 0
end end
+14 -18
View File
@@ -38,31 +38,27 @@
# Falls back to random choice if GNU shuf is missing, but shuf is # Falls back to random choice if GNU shuf is missing, but shuf is
# much faster for files with >1000 lines. # much faster for files with >1000 lines.
function rand_string --description 'Generate random, memorable strings from curated word databases' function rand_string --description 'Generate random, memorable strings from curated word databases'
set -l c_head (set_color --bold cyan) __fish_palette
set -l c_cmd (set_color --bold)
set -l c_arg (set_color cyan)
set -l c_flag (set_color yellow)
set -l c_rst (set_color normal)
if set -q argv[1]; and contains -- $argv[1] -h --help if set -q argv[1]; and contains -- $argv[1] -h --help
echo "$c_head""Usage:$c_rst $c_cmd""rand_string$c_rst $c_arg""[COMPONENTS/MODIFIERS]...$c_rst" echo "$c_head""Usage:$c_reset $c_cmd""rand_string$c_reset $c_arg""[COMPONENTS/MODIFIERS]...$c_reset"
echo echo
echo " Generate random, memorable strings from curated word databases." echo " Generate random, memorable strings from curated word databases."
echo echo
echo "$c_head""Components:$c_rst" echo "$c_head""Components:$c_reset"
echo " $c_arg<category>$c_rst A bundled word list (e.g. adjective, animal, color, name, noun, verb)" echo " $c_arg<category>$c_reset A bundled word list (e.g. adjective, animal, color, name, noun, verb)"
echo " $c_arg""digits=<N>$c_rst N random digits (e.g. digits=3 -> 842)" echo " $c_arg""digits=<N>$c_reset N random digits (e.g. digits=3 -> 842)"
echo " $c_arg""literal=<text>$c_rst A static string component for prefixes/suffixes (e.g. literal=TEST)" echo " $c_arg""literal=<text>$c_reset A static string component for prefixes/suffixes (e.g. literal=TEST)"
echo echo
echo "$c_head""Modifiers:$c_rst" echo "$c_head""Modifiers:$c_reset"
echo " $c_flag-s$c_rst, $c_flag--separator=<sep>$c_rst Delimiter for subsequent words (dash, underscore, dot, none)" echo " $c_flag-s$c_reset, $c_flag--separator=<sep>$c_reset Delimiter for subsequent words (dash, underscore, dot, none)"
echo " $c_flag-c$c_rst, $c_flag--case=<casing>$c_rst Casing for subsequent words (lower, upper, title)" echo " $c_flag-c$c_reset, $c_flag--case=<casing>$c_reset Casing for subsequent words (lower, upper, title)"
echo " $c_flag-h$c_rst, $c_flag--help$c_rst Show usage help" echo " $c_flag-h$c_reset, $c_flag--help$c_reset Show usage help"
echo echo
echo "$c_head""Examples:$c_rst" echo "$c_head""Examples:$c_reset"
echo " $c_cmd""rand_string$c_rst adjective animal" echo " $c_cmd""rand_string$c_reset adjective animal"
echo " $c_cmd""rand_string$c_rst --case=title color animal --separator=dot digits=4" echo " $c_cmd""rand_string$c_reset --case=title color animal --separator=dot digits=4"
echo " $c_cmd""rand_string$c_rst literal=TEST --separator=underscore verb noun" echo " $c_cmd""rand_string$c_reset literal=TEST --separator=underscore verb noun"
return 0 return 0
end end
+5 -9
View File
@@ -44,20 +44,16 @@ function smart_exit --description 'Capture colorized scrollback before exiting,
argparse $options -- $argv argparse $options -- $argv
or return 1 or return 1
set -l c_primary (set_color cyan) __fish_palette
set -l c_accent (set_color green)
set -l c_warn (set_color yellow)
set -l c_bold (set_color --bold)
set -l c_reset (set_color normal)
if set -q _flag_help if set -q _flag_help
echo -e "Usage: $c_accent"exit"$c_reset [$c_primary""OPTIONS""$c_reset]" echo -e "Usage: $c_accent"exit"$c_reset [$c_arg""OPTIONS""$c_reset]"
echo "" echo ""
echo "Closes the current shell session, automatically archiving the window scrollback." echo "Closes the current shell session, automatically archiving the window scrollback."
echo "" echo ""
echo "Options:" echo "Options:"
echo -e " $c_primary""-h, --help""$c_reset Show this help message" echo -e " $c_arg""-h, --help""$c_reset Show this help message"
echo -e " $c_primary""-n, --no-log""$c_reset Exit immediately $c_bold""without""$c_reset saving a scrollback history log" echo -e " $c_arg""-n, --no-log""$c_reset Exit immediately $c_cmd""without""$c_reset saving a scrollback history log"
return 0 return 0
end end
@@ -112,7 +108,7 @@ function smart_exit --description 'Capture colorized scrollback before exiting,
end end
end end
else else
echo -e "$c_warn""➔""$c_reset Exiting discreetly; $c_bold""no history logs saved.""$c_reset" echo -e "$c_warn""➔""$c_reset Exiting discreetly; $c_cmd""no history logs saved.""$c_reset"
sleep 0.4 sleep 0.4
end end