Merge pull request 'feat(functions): derive the shared help palette from the fish theme' (#159) from feat/theme-driven-help-palette into main
This commit was merged in pull request #159.
This commit is contained in:
@@ -45,9 +45,10 @@ function __fish_help_header --argument-names name
|
||||
# First argument only -- see DESCRIPTION.
|
||||
contains -- "$argv[2]" -h --help; or return 1
|
||||
|
||||
set -l c_ttl (set_color --bold)
|
||||
set -l c_sec (set_color --bold brblue)
|
||||
set -l c_rst (set_color normal)
|
||||
__fish_palette
|
||||
set -l c_ttl $c_cmd
|
||||
set -l c_sec $c_head
|
||||
set -l c_rst $c_reset
|
||||
set -l miss " No documentation header found. Try: help config $name"
|
||||
|
||||
set -l file (functions -D -- $name 2>/dev/null)
|
||||
|
||||
@@ -19,11 +19,18 @@
|
||||
# TERM=dumb, which yields empty strings, and is unaffected by whether
|
||||
# stdout is a tty or a pipe.)
|
||||
#
|
||||
# A role is a semantic slot, not a colour. c_flag and c_warn are both
|
||||
# yellow but stay separate, as do c_ok and c_accent (both green) --
|
||||
# merging either pair would foreclose ever restyling one without the
|
||||
# other. c_accent is the command name in logs and smart_exit, which
|
||||
# style it green where the rest of the config styles it bold.
|
||||
# A role is a semantic slot, not a colour. c_flag and c_warn can both be
|
||||
# yellow but stay separate, as do c_ok and c_accent -- merging either
|
||||
# pair would foreclose ever restyling one without the other. c_accent is
|
||||
# the command name in logs and smart_exit, which style it green where
|
||||
# the rest of the config styles it bold.
|
||||
#
|
||||
# c_cmd, c_flag, c_arg, and c_dim are drawn from fish's own highlighter
|
||||
# variables (fish_color_command/option/param/autosuggestion) when set,
|
||||
# and c_head from the pager's fish_pager_color_prefix -- the same colour
|
||||
# a real command, flag, argument, or pager heading gets at the prompt.
|
||||
# Each falls back to its previous static default when the theme
|
||||
# variable is unset or empty (e.g. a --no-config script).
|
||||
#
|
||||
# ARGUMENTS
|
||||
# none
|
||||
@@ -49,15 +56,27 @@
|
||||
|
||||
function __fish_palette --no-scope-shadowing --description 'Define the shared output colour palette in the caller scope'
|
||||
set c_reset (set_color normal)
|
||||
set c_head (set_color --bold cyan)
|
||||
set c_cmd (set_color --bold)
|
||||
set c_cmd (set_color brblue)
|
||||
set c_flag (set_color brgreen)
|
||||
set c_arg (set_color cyan)
|
||||
set c_flag (set_color yellow)
|
||||
set c_dim (set_color brblack)
|
||||
set c_head (set_color --bold cyan)
|
||||
set c_warn (set_color yellow)
|
||||
set c_err (set_color red)
|
||||
set c_ok (set_color green)
|
||||
set c_accent (set_color green)
|
||||
set c_dim (set_color brblack)
|
||||
set c_sel (set_color --bold magenta)
|
||||
set c_hi (set_color --bold white)
|
||||
|
||||
# Theme overrides: same roles fish's own highlighter/pager use, so
|
||||
# --help text matches the prompt instead of a fixed guess at it.
|
||||
set -l roles command option param autosuggestion
|
||||
set -l vars c_cmd c_flag c_arg c_dim
|
||||
for i in (seq (count $roles))
|
||||
set -l themevar fish_color_$roles[$i]
|
||||
set -q $themevar; and test (count $$themevar) -gt 0
|
||||
and set $vars[$i] (set_color $$themevar)
|
||||
end
|
||||
set -q fish_pager_color_prefix; and test (count $fish_pager_color_prefix) -gt 0
|
||||
and set c_head (set_color --bold $fish_pager_color_prefix)
|
||||
end
|
||||
|
||||
+35
-46
@@ -190,63 +190,52 @@ function config-help --description 'Open the offline fish shell configuration ma
|
||||
|
||||
# ── --help / -h ──────────────────────────────────────────────
|
||||
if contains -- --help $argv; or contains -- -h $argv
|
||||
set_color --bold
|
||||
echo "help config / config-help"
|
||||
set_color normal
|
||||
__fish_palette
|
||||
echo "$c_cmd""help config / config-help$c_reset"
|
||||
echo " — view the offline fish shell configuration manual"
|
||||
echo ""
|
||||
set_color --bold brblue
|
||||
echo USAGE
|
||||
set_color normal
|
||||
echo " help config "(set_color yellow)"[section]"(set_color normal)
|
||||
echo " help config "(set_color yellow)"[section] --html"(set_color normal)
|
||||
echo " help config "(set_color yellow)"[section] --man"(set_color normal)
|
||||
echo " help config "(set_color yellow)"--help"(set_color normal)
|
||||
echo "$c_head""USAGE$c_reset"
|
||||
echo " $c_cmd""help config$c_reset $c_arg""[section]$c_reset"
|
||||
echo " $c_cmd""help config$c_reset $c_arg""[section]$c_reset $c_flag--html$c_reset"
|
||||
echo " $c_cmd""help config$c_reset $c_arg""[section]$c_reset $c_flag--man$c_reset"
|
||||
echo " $c_cmd""help config$c_reset $c_flag--help$c_reset"
|
||||
echo ""
|
||||
set_color --bold brblue
|
||||
echo ARGUMENTS
|
||||
set_color normal
|
||||
echo " "(set_color yellow)"section"(set_color normal)" Optional keyword to jump to a matching section heading."
|
||||
echo "$c_head""ARGUMENTS$c_reset"
|
||||
echo " $c_arg""section$c_reset Optional keyword to jump to a matching section heading."
|
||||
echo " Searches docs/fish-config.index for aliases first, then"
|
||||
echo " falls back to a normalized (case- and punctuation-insensitive)"
|
||||
echo " scan of heading lines."
|
||||
echo " "(set_color yellow)"-w, --html"(set_color normal)" Open the published documentation website in the default browser."
|
||||
echo " $c_flag-w, --html$c_reset Open the published documentation website in the default browser."
|
||||
echo " Deep links aren't supported — use the site's search box."
|
||||
echo " "(set_color yellow)"-m, --man"(set_color normal)" Open the compiled man page via man -l."
|
||||
echo " $c_flag-m, --man$c_reset Open the compiled man page via man -l."
|
||||
echo " If a section keyword is given, jumps to the nearest match."
|
||||
echo ""
|
||||
set_color --bold brblue
|
||||
echo EXAMPLES
|
||||
set_color normal
|
||||
echo " "(set_color green)"help config"(set_color normal)" open at top"
|
||||
echo " "(set_color green)"help config keybindings"(set_color normal)" jump to Key Bindings section"
|
||||
echo " "(set_color green)"help config pkg"(set_color normal)" jump to the pkg function entry"
|
||||
echo " "(set_color green)"help config fish-deps"(set_color normal)" jump to fish-deps"
|
||||
echo " "(set_color green)"help config abbreviations"(set_color normal)" jump to Abbreviations section"
|
||||
echo " "(set_color green)"help config --html"(set_color normal)" open the documentation website"
|
||||
echo " "(set_color green)"help config --man"(set_color normal)" open compiled man page"
|
||||
echo " "(set_color green)"help config pkg --man"(set_color normal)" open man page at pkg section"
|
||||
echo "$c_head""EXAMPLES$c_reset"
|
||||
echo " $c_cmd""help config$c_reset open at top"
|
||||
echo " $c_cmd""help config$c_reset $c_arg""keybindings$c_reset jump to Key Bindings section"
|
||||
echo " $c_cmd""help config$c_reset $c_arg""pkg$c_reset jump to the pkg function entry"
|
||||
echo " $c_cmd""help config$c_reset $c_arg""fish-deps$c_reset jump to fish-deps"
|
||||
echo " $c_cmd""help config$c_reset $c_arg""abbreviations$c_reset jump to Abbreviations section"
|
||||
echo " $c_cmd""help config$c_reset $c_flag--html$c_reset open the documentation website"
|
||||
echo " $c_cmd""help config$c_reset $c_flag--man$c_reset open compiled man page"
|
||||
echo " $c_cmd""help config$c_reset $c_arg""pkg$c_reset $c_flag--man$c_reset open man page at pkg section"
|
||||
echo ""
|
||||
set_color --bold brblue
|
||||
echo "NAVIGATION (ov pager)"
|
||||
set_color normal
|
||||
echo " "(set_color cyan)"Space"(set_color normal)" next section"
|
||||
echo " "(set_color cyan)"^"(set_color normal)" previous section"
|
||||
echo " "(set_color cyan)"Alt+u"(set_color normal)" toggle section list sidebar"
|
||||
echo " "(set_color cyan)"/"(set_color normal)" search forward"
|
||||
echo " "(set_color cyan)"n"(set_color normal)" / "(set_color cyan)"N"(set_color normal)" next / previous search match"
|
||||
echo " "(set_color cyan)"g"(set_color normal)" go to line number"
|
||||
echo " "(set_color cyan)"q"(set_color normal)" quit"
|
||||
echo "$c_head""NAVIGATION (ov pager)$c_reset"
|
||||
echo " $c_arg""Space$c_reset next section"
|
||||
echo " $c_arg""^$c_reset previous section"
|
||||
echo " $c_arg""Alt+u$c_reset toggle section list sidebar"
|
||||
echo " $c_arg""/$c_reset search forward"
|
||||
echo " $c_arg""n$c_reset / $c_arg""N$c_reset next / previous search match"
|
||||
echo " $c_arg""g$c_reset go to line number"
|
||||
echo " $c_arg""q$c_reset quit"
|
||||
echo ""
|
||||
set_color --bold brblue
|
||||
echo "PAGER FALLBACK CHAIN"
|
||||
set_color normal
|
||||
echo " "(set_color brblack)"1."(set_color normal)" ov + bat section nav + syntax highlighting "(set_color brblack)"(best)"(set_color normal)
|
||||
echo " "(set_color brblack)"2."(set_color normal)" ov alone section nav, raw Markdown"
|
||||
echo " "(set_color brblack)"3."(set_color normal)" bat alone syntax highlighting, use / to search"
|
||||
echo " "(set_color brblack)"4."(set_color normal)" man -l pre-compiled man page (if available)"
|
||||
echo " "(set_color brblack)"5."(set_color normal)" less plain text with line-jump"
|
||||
echo " "(set_color brblack)"6."(set_color normal)" cat plain output"
|
||||
echo "$c_head""PAGER FALLBACK CHAIN$c_reset"
|
||||
echo " $c_dim""1.$c_reset $c_cmd""ov$c_reset + $c_cmd""bat$c_reset section nav + syntax highlighting $c_dim""(best)$c_reset"
|
||||
echo " $c_dim""2.$c_reset $c_cmd""ov$c_reset alone section nav, raw Markdown"
|
||||
echo " $c_dim""3.$c_reset $c_cmd""bat$c_reset alone syntax highlighting, use / to search"
|
||||
echo " $c_dim""4.$c_reset $c_cmd""man$c_reset $c_flag-l$c_reset pre-compiled man page (if available)"
|
||||
echo " $c_dim""5.$c_reset $c_cmd""less$c_reset plain text with line-jump"
|
||||
echo " $c_dim""6.$c_reset $c_cmd""cat$c_reset plain output"
|
||||
return 0
|
||||
end
|
||||
|
||||
|
||||
@@ -39,13 +39,13 @@ function dng2avif --description 'Convert DNG raw to 10-bit HDR AVIF'
|
||||
# Help Screen
|
||||
if set -q _flag_help; or test (count $argv) -eq 0 -a -z "$_flag_input"
|
||||
__fish_palette
|
||||
echo "$c_head""Usage:$c_reset $c_cmd""dng2avif$c_reset $c_flag""[options]$c_reset $c_dim""[input.dng]$c_reset"
|
||||
echo "$c_head""Usage:$c_reset $c_cmd""dng2avif$c_reset $c_flag""[options]$c_reset $c_arg""[input.dng]$c_reset"
|
||||
echo ""
|
||||
echo "$c_head""Options:$c_reset"
|
||||
echo " $c_flag-i$c_reset, $c_flag--input$c_reset $c_dim""FILE$c_reset Input DNG file"
|
||||
echo " $c_flag-o$c_reset, $c_flag--output$c_reset $c_dim""FILE$c_reset Output AVIF file (defaults to input name)"
|
||||
echo " $c_flag-q$c_reset, $c_flag--quality$c_reset $c_dim""N$c_reset Encoding quality 0-100 (default: 92)"
|
||||
echo " $c_flag-s$c_reset, $c_flag--speed$c_reset $c_dim""N$c_reset Encoder speed 0-10 (default: 3, 0=slowest)"
|
||||
echo " $c_flag-i$c_reset, $c_flag--input$c_reset $c_arg""FILE$c_reset Input DNG file"
|
||||
echo " $c_flag-o$c_reset, $c_flag--output$c_reset $c_arg""FILE$c_reset Output AVIF file (defaults to input name)"
|
||||
echo " $c_flag-q$c_reset, $c_flag--quality$c_reset $c_arg""N$c_reset Encoding quality 0-100 (default: 92)"
|
||||
echo " $c_flag-s$c_reset, $c_flag--speed$c_reset $c_arg""N$c_reset Encoder speed 0-10 (default: 3, 0=slowest)"
|
||||
echo " $c_flag-h$c_reset, $c_flag--help$c_reset Show this help message"
|
||||
return 0
|
||||
end
|
||||
|
||||
@@ -31,13 +31,13 @@ function dockup --description 'Pull and restart docker compose containers'
|
||||
# Handle help flags
|
||||
if contains -- -h $argv; or contains -- --help $argv
|
||||
__fish_palette
|
||||
echo "$c_head""Usage:$c_reset $c_cmd""dockup$c_reset $c_dim""[DIRECTORY]$c_reset"
|
||||
echo "$c_head""Usage:$c_reset $c_cmd""dockup$c_reset $c_arg""[DIRECTORY]$c_reset"
|
||||
echo ""
|
||||
echo "$c_head""Options:$c_reset"
|
||||
echo " $c_flag-h$c_reset, $c_flag--help$c_reset Show this help message"
|
||||
echo ""
|
||||
echo "$c_head""Arguments:$c_reset"
|
||||
echo " $c_dim""DIRECTORY$c_reset Optional path to the compose project (defaults to current dir)"
|
||||
echo " $c_arg""DIRECTORY$c_reset Optional path to the compose project (defaults to current dir)"
|
||||
return 0
|
||||
end
|
||||
|
||||
|
||||
@@ -105,7 +105,7 @@ function __fish_deps_help
|
||||
echo "$c_head""fish-deps$c_reset — manage fish shell dependencies"
|
||||
echo ""
|
||||
echo "$c_head""Usage:$c_reset"
|
||||
echo " $c_cmd""fish-deps$c_reset $c_dim""[status]$c_reset Check installed/missing deps (default)"
|
||||
echo " $c_cmd""fish-deps$c_reset $c_arg""[status]$c_reset Check installed/missing deps (default)"
|
||||
echo " $c_cmd""fish-deps$c_reset install Install missing deps interactively"
|
||||
echo " $c_cmd""fish-deps$c_reset update Update all installed deps"
|
||||
echo " $c_cmd""fish-deps$c_reset sync Install missing, then update all"
|
||||
|
||||
+20
-23
@@ -39,32 +39,29 @@ function gi --description 'Generate .gitignore files using the gitignore.io API'
|
||||
or return 1
|
||||
|
||||
if set -q _flag_help
|
||||
set_color --bold
|
||||
echo "Usage:"(set_color normal)" gi "(set_color cyan)"[TARGETS...]"(set_color yellow)" [FLAGS]"(set_color normal)
|
||||
__fish_palette
|
||||
echo "$c_head""Usage:$c_reset $c_cmd""gi$c_reset $c_arg""[TARGETS...]$c_reset $c_arg""[FLAGS]$c_reset"
|
||||
echo ""
|
||||
set_color --bold
|
||||
echo "Arguments:"(set_color normal)
|
||||
echo " "(set_color cyan)"TARGETS"(set_color normal)" Comma-separated list of languages or tools"
|
||||
echo " "(set_color brblack)"e.g. c++,neovim,archlinux"(set_color normal)
|
||||
echo "$c_head""Arguments:$c_reset"
|
||||
echo " $c_arg""TARGETS$c_reset Comma-separated list of languages or tools"
|
||||
echo " $c_dim""e.g. c++,neovim,archlinux$c_reset"
|
||||
echo ""
|
||||
set_color --bold
|
||||
echo "Flags:"(set_color normal)
|
||||
echo " "(set_color yellow)"-h, --help "(set_color normal)" Show this help message"
|
||||
echo " "(set_color yellow)"-d, --description "(set_color normal)" Show the Fish function description"
|
||||
echo " "(set_color yellow)"-l, --list "(set_color normal)" List all supported targets from the API"
|
||||
echo " "(set_color yellow)"-b, --boilerplate "(set_color normal)" Append boilerplate from "(set_color cyan)"\$GITIGNORE_BOILERPLATE"(set_color normal)" to .gitignore"
|
||||
echo " "(set_color yellow)"-p, --prompt "(set_color normal)" Prompt for patterns and append them to .gitignore"
|
||||
echo " "(set_color yellow)"-s, --stdout "(set_color normal)" Print API output to stdout instead of appending to .gitignore"
|
||||
echo "$c_head""Flags:$c_reset"
|
||||
echo " $c_flag-h, --help $c_reset Show this help message"
|
||||
echo " $c_flag-d, --description $c_reset Show the Fish function description"
|
||||
echo " $c_flag-l, --list $c_reset List all supported targets from the API"
|
||||
echo " $c_flag-b, --boilerplate $c_reset Append boilerplate from $c_arg""\$GITIGNORE_BOILERPLATE$c_reset to .gitignore"
|
||||
echo " $c_flag-p, --prompt $c_reset Prompt for patterns and append them to .gitignore"
|
||||
echo " $c_flag-s, --stdout $c_reset Print API output to stdout instead of appending to .gitignore"
|
||||
echo ""
|
||||
set_color --bold
|
||||
echo "Examples:"(set_color normal)
|
||||
echo " "(set_color green)"gi"(set_color normal)" "(set_color brblack)"# Append boilerplate and prompt for patterns (default)"(set_color normal)
|
||||
echo " "(set_color green)"gi -b"(set_color normal)" "(set_color brblack)"# Append boilerplate only"(set_color normal)
|
||||
echo " "(set_color green)"gi -p"(set_color normal)" "(set_color brblack)"# Prompt for patterns and append to .gitignore"(set_color normal)
|
||||
echo " "(set_color green)"gi"(set_color normal)" "(set_color cyan)"c++"(set_color normal)" "(set_color brblack)"# Append C++ patterns to .gitignore"(set_color normal)
|
||||
echo " "(set_color green)"gi"(set_color normal)" "(set_color cyan)"python,venv"(set_color normal)" "(set_color brblack)"# Append Python+venv patterns to .gitignore"(set_color normal)
|
||||
echo " "(set_color green)"gi -s"(set_color normal)" "(set_color cyan)"python,venv"(set_color normal)" "(set_color brblack)"# Print Python+venv patterns to stdout"(set_color normal)
|
||||
echo " "(set_color green)"gi -l"(set_color normal)" | grep -i linux "(set_color brblack)"# Search for specific OS support"(set_color normal)
|
||||
echo "$c_head""Examples:$c_reset"
|
||||
echo " $c_cmd""gi$c_reset $c_dim""# Append boilerplate and prompt for patterns (default)$c_reset"
|
||||
echo " $c_cmd""gi -b$c_reset $c_dim""# Append boilerplate only$c_reset"
|
||||
echo " $c_cmd""gi -p$c_reset $c_dim""# Prompt for patterns and append to .gitignore$c_reset"
|
||||
echo " $c_cmd""gi$c_reset $c_arg""c++$c_reset $c_dim""# Append C++ patterns to .gitignore$c_reset"
|
||||
echo " $c_cmd""gi$c_reset $c_arg""python,venv$c_reset $c_dim""# Append Python+venv patterns to .gitignore$c_reset"
|
||||
echo " $c_cmd""gi -s$c_reset $c_arg""python,venv$c_reset $c_dim""# Print Python+venv patterns to stdout$c_reset"
|
||||
echo " $c_cmd""gi -l$c_reset | grep -i linux $c_dim""# Search for specific OS support$c_reset"
|
||||
return 0
|
||||
end
|
||||
|
||||
|
||||
@@ -29,9 +29,10 @@ function git-clean --description 'Sync main, prune remotes, and delete orphaned
|
||||
or return
|
||||
|
||||
if set -q _flag_help
|
||||
echo (set_color --bold blue)"Usage: "(set_color normal)"git-clean [OPTIONS]"
|
||||
__fish_palette
|
||||
echo "$c_head""Usage:$c_reset $c_cmd""git-clean$c_reset $c_arg""[OPTIONS]$c_reset"
|
||||
echo
|
||||
echo "Steps taken:"
|
||||
echo "$c_head""Steps taken:$c_reset"
|
||||
echo " 1. Fetches and prunes to find deleted remote branches."
|
||||
echo " 2. Switches to main if you are on an orphaned branch."
|
||||
echo " 3. Pulls the latest changes from the remote."
|
||||
|
||||
+5
-5
@@ -50,16 +50,16 @@ function logs --description 'Browse terminal log files interactively with fzf'
|
||||
|
||||
if set -q _flag_help
|
||||
__fish_palette
|
||||
echo "Usage: "$c_accent"logs"$c_reset" ["$c_arg"OPTIONS"$c_reset"]"
|
||||
echo "$c_head""Usage:$c_reset "$c_cmd"logs"$c_reset" ["$c_arg"OPTIONS"$c_reset"]"
|
||||
echo ""
|
||||
echo "Browse and open terminal log files interactively."
|
||||
echo "Logs sorted newest-first. Type to fuzzy-filter by date or category."
|
||||
echo ""
|
||||
echo "Options:"
|
||||
echo " "$c_arg"-h, --help"$c_reset" Show this help"
|
||||
echo " "$c_arg"-c, --category"$c_reset" Limit to one category: scrollback, paru, yay"
|
||||
echo "$c_head""Options:$c_reset"
|
||||
echo " "$c_flag"-h, --help"$c_reset" Show this help"
|
||||
echo " "$c_flag"-c, --category"$c_reset" Limit to one category: scrollback, paru, yay"
|
||||
echo ""
|
||||
echo "Keys in fzf:"
|
||||
echo "$c_head""Keys in fzf:$c_reset"
|
||||
echo " "$c_arg"Enter"$c_reset" Open in \$PAGER"
|
||||
echo " "$c_arg"Ctrl-E"$c_reset" Open in \$EDITOR"
|
||||
echo " "$c_arg"Ctrl-D"$c_reset" Delete selected log"
|
||||
|
||||
+2
-2
@@ -73,7 +73,7 @@ function pkg --description 'Install or remove packages via the system package ma
|
||||
switch $arg
|
||||
case -h --help
|
||||
echo "$c_head""Usage:$c_reset $c_cmd""pkg$c_reset " \
|
||||
"$c_flag""[-h] [-i] [-u]$c_reset $c_dim""<package>...$c_reset"
|
||||
"$c_flag""[-h] [-i] [-u]$c_reset $c_arg""<package>...$c_reset"
|
||||
echo
|
||||
echo " Install or remove packages via $pm."
|
||||
echo
|
||||
@@ -107,7 +107,7 @@ function pkg --description 'Install or remove packages via the system package ma
|
||||
|
||||
if test (count $packages) -eq 0
|
||||
echo "$c_head""Usage:$c_reset $c_cmd""pkg$c_reset " \
|
||||
"$c_flag""[-h] [-i] [-u]$c_reset $c_dim""<package>...$c_reset"
|
||||
"$c_flag""[-h] [-i] [-u]$c_reset $c_arg""<package>...$c_reset"
|
||||
echo
|
||||
echo " Install or remove packages via $pm."
|
||||
echo
|
||||
|
||||
@@ -42,12 +42,12 @@ function play-media --description 'Pick audio/video files with fzf and play them
|
||||
or return 1
|
||||
|
||||
if set -q _flag_help
|
||||
echo "$c_head""Usage:$c_reset $c_cmd""play-media$c_reset $c_flag""[-p|--player$c_reset $c_dim<cmd>$c_reset""$c_flag]$c_reset"
|
||||
echo "$c_head""Usage:$c_reset $c_cmd""play-media$c_reset $c_flag""[-p|--player$c_reset $c_arg<cmd>$c_reset""$c_flag]$c_reset"
|
||||
echo
|
||||
echo " Pick audio/video files under the current directory with fzf and play them."
|
||||
echo
|
||||
echo "$c_head""Options:$c_reset"
|
||||
echo " $c_flag-p$c_reset, $c_flag--player$c_reset $c_dim<cmd>$c_reset Force a specific player command"
|
||||
echo " $c_flag-p$c_reset, $c_flag--player$c_reset $c_arg<cmd>$c_reset Force a specific player command"
|
||||
echo " $c_flag-h$c_reset, $c_flag--help$c_reset Show this help"
|
||||
return 0
|
||||
end
|
||||
|
||||
@@ -79,7 +79,7 @@ function scrub --description 'Recursively purge OS, editor, and compiler garbage
|
||||
echo " • Compiles: core.[0-9]+ (Linux core dumps)"
|
||||
echo " • Slicers: *.gcode.tmp, *.gcode.bak, .bambu_bak"
|
||||
echo
|
||||
echo (set_color --bold yellow)"Aggressive Targets:"(set_color normal)
|
||||
echo "$c_head""Aggressive Targets:$c_reset"
|
||||
echo " • Heavy Caches: node_modules, .vagrant"
|
||||
echo " • Extra Cruft: *.class, *.log, *.log.[0-9]+, Thumbs.db:encryptable"
|
||||
echo " • IDE/Git Junk: .idea, .clwb, .git-crypt"
|
||||
|
||||
@@ -47,13 +47,13 @@ function smart_exit --description 'Capture colorized scrollback before exiting,
|
||||
__fish_palette
|
||||
|
||||
if set -q _flag_help
|
||||
echo -e "Usage: $c_accent"exit"$c_reset [$c_arg""OPTIONS""$c_reset]"
|
||||
echo -e "$c_head""Usage:$c_reset $c_cmd"exit"$c_reset [$c_arg""OPTIONS""$c_reset]"
|
||||
echo ""
|
||||
echo "Closes the current shell session, automatically archiving the window scrollback."
|
||||
echo ""
|
||||
echo "Options:"
|
||||
echo -e " $c_arg""-h, --help""$c_reset Show this help message"
|
||||
echo -e " $c_arg""-n, --no-log""$c_reset Exit immediately $c_cmd""without""$c_reset saving a scrollback history log"
|
||||
echo "$c_head""Options:$c_reset"
|
||||
echo -e " $c_flag""-h, --help""$c_reset Show this help message"
|
||||
echo -e " $c_flag""-n, --no-log""$c_reset Exit immediately without saving a scrollback history log"
|
||||
return 0
|
||||
end
|
||||
|
||||
|
||||
+49
-4
@@ -145,10 +145,10 @@ check "palette roles all defined, non-empty, and scoped to the caller" true (tes
|
||||
# which is not installed in CI, so its colour path is unreachable here.
|
||||
# tests/palette-bytes.fish stubs aichat and does cover it.
|
||||
function test_functions_keep_their_palette
|
||||
set -l colored agents-init agents-vault auto-pull config-settings \
|
||||
config-update detach dng2avif dockup edit jobrunner kitty-logging \
|
||||
logs mkcd open-url p pkg play-media rand_string replay repo-open \
|
||||
scrub smart_exit spark y
|
||||
set -l colored agents-init agents-vault auto-pull config-help \
|
||||
config-settings config-update detach dng2avif dockup edit fish-deps \
|
||||
gi git-clean jobrunner kitty-logging logs mkcd mkrep open-url p pkg \
|
||||
play-media rand_string replay repo-open scrub smart_exit spark y
|
||||
set -l uncolored
|
||||
for fn in $colored
|
||||
functions -q $fn; or continue
|
||||
@@ -164,6 +164,51 @@ function test_functions_keep_their_palette
|
||||
end
|
||||
check "colored --help output keeps its escape sequences" true (test_functions_keep_their_palette; and echo true; or echo false)
|
||||
|
||||
# The presence check above only catches a --help block that lost ALL of its
|
||||
# colour. It would not have caught the actual regressions found by hand in
|
||||
# config-help/logs/smart_exit: a heading or command name left in the PREVIOUS
|
||||
# static colour (or another role's colour) instead of the current dynamic
|
||||
# one, because *some* escape sequence is still present -- just the wrong
|
||||
# one. These two checks compare against the palette's OWN roles, computed in
|
||||
# this same session, so they track the theme instead of a hand-copied value.
|
||||
#
|
||||
# c_warn/c_err/c_ok/c_accent/c_sel/c_hi are deliberately excluded from
|
||||
# "allowed": those are the STATIC roles (see __fish_palette's own NOTES) and
|
||||
# are legitimate elsewhere, but a --help block that reaches for one of them
|
||||
# is always a mistake -- logs and smart_exit both did this, coloring their
|
||||
# own command name with the static c_accent green instead of the
|
||||
# theme-derived c_cmd. Reusing $colored from the test above -- same
|
||||
# functions, same "not installed" skip.
|
||||
function test_help_colors_are_theme_derived
|
||||
__fish_palette
|
||||
set -l allowed $c_reset $c_head $c_cmd $c_flag $c_arg $c_dim
|
||||
set -l colored agents-init agents-vault auto-pull config-help \
|
||||
config-settings config-update detach dng2avif dockup edit fish-deps \
|
||||
gi git-clean jobrunner kitty-logging logs mkcd mkrep open-url p pkg \
|
||||
play-media rand_string replay repo-open scrub smart_exit spark y
|
||||
set -l failed 0
|
||||
for fn in $colored
|
||||
functions -q $fn; or continue
|
||||
set -l out ($fn --help 2>&1 | string collect)
|
||||
set -l missing_head 0
|
||||
set -l missing_cmd 0
|
||||
string match -q "*$c_head*" -- $out; or set missing_head 1
|
||||
string match -q "*$c_cmd*" -- $out; or set missing_cmd 1
|
||||
if test $missing_head -eq 1; or test $missing_cmd -eq 1
|
||||
echo " $fn: missing"(test $missing_head -eq 1; and echo " a heading (c_head)")(test $missing_cmd -eq 1; and echo " its own command color (c_cmd)")
|
||||
set failed 1
|
||||
end
|
||||
for code in (string match -ar -- '\e\[[0-9;]*m' -- $out | sort -u)
|
||||
if not contains -- $code $allowed
|
||||
echo " $fn: --help uses a color outside the head/cmd/flag/arg/dim/reset roles"
|
||||
set failed 1
|
||||
end
|
||||
end
|
||||
end
|
||||
return $failed
|
||||
end
|
||||
check "help output uses only the dynamic head/cmd/flag/arg roles" true (test_help_colors_are_theme_derived; and echo true; or echo false)
|
||||
|
||||
section "session: config-settings state dump"
|
||||
|
||||
# The curses TUI is a child process: it can neither read the session's global
|
||||
|
||||
Reference in New Issue
Block a user