feat(help): standardize colored --help output across functions

Add the established c_head/c_cmd/c_flag/c_dim/c_arg color scheme to
--help (or usage-on-error) output in play-media and 13 other functions
that lacked it or used an ad hoc scheme: bkg, detach, replay, p, y,
spark, wake-lock, open-url, repo-open, dng2avif, dockup, fish-deps
(__fish_deps_help), and scrub.

Also tweak the standard itself:
- c_cmd now uses plain `set_color --bold` instead of `--bold white`,
  so the command name adapts to the terminal's foreground instead of
  forcing white text that washes out on light-background themes.
  Applied across all functions already using the pattern.
- jobrunner's reset variable renamed from c_rst to c_reset to match
  the naming used everywhere else.
This commit is contained in:
2026-08-22 00:19:43 -04:00
parent 4006a2f855
commit 500dd8a735
25 changed files with 214 additions and 138 deletions
+1 -1
View File
@@ -77,7 +77,7 @@
# agents-init --quiet
function agents-init --description 'scaffold AGENTS/ sub-repo with agent spec files and plugin dirs'
set -l c_head (set_color --bold cyan)
set -l c_cmd (set_color --bold white)
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)
+1 -1
View File
@@ -43,7 +43,7 @@
# auto-pull remove qmk_firmware
function auto-pull --description 'Manage the auto-pull repository registry'
set -l c_head (set_color --bold cyan)
set -l c_cmd (set_color --bold white)
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)
+5 -1
View File
@@ -25,7 +25,11 @@
function bkg --description 'Execute bkg'
# Check if a command was provided as an argument.
if test -z "$argv[1]"
echo "Usage: bkg <command> [arguments...]"
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)
echo "$c_head""Usage:$c_reset $c_cmd""bkg$c_reset $c_arg""<command> [arguments...]$c_reset"
return 1
end
+1 -1
View File
@@ -70,7 +70,7 @@
# config-settings
function config-settings --description 'Interactive TUI for managing fish config settings'
set -l c_head (set_color --bold cyan)
set -l c_cmd (set_color --bold white)
set -l c_cmd (set_color --bold)
set -l c_flag (set_color yellow)
set -l c_dim (set_color brblack)
set -l c_err (set_color red)
+1 -1
View File
@@ -28,7 +28,7 @@
# config-update --force
function config-update --description 'Pull latest fish config from upstream'
set -l c_head (set_color --bold cyan)
set -l c_cmd (set_color --bold white)
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)
+14 -8
View File
@@ -25,6 +25,12 @@
# EXAMPLE
# detach rsync -a ./data remote:/backup/
function detach --description 'Execute detach'
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_arg (set_color cyan)
set -l c_reset (set_color normal)
set -l show_help 0
set -l args
@@ -45,16 +51,16 @@ function detach --description 'Execute detach'
end
if test $show_help -eq 1
echo "Usage: detach [command...]"
echo "Runs a command in the background, fully detached from the terminal."
echo "$c_head""Usage:$c_reset $c_cmd""detach$c_reset $c_arg""[command...]$c_reset"
echo " Runs a command in the background, fully detached from the terminal."
echo
echo "Options:"
echo " -h, --help Show this help message"
echo " --version Show version information"
echo "$c_head""Options:$c_reset"
echo " $c_flag-h$c_reset, $c_flag--help$c_reset Show this help message"
echo " $c_flag--version$c_reset Show version information"
echo
echo "Example:"
echo " detach firefox"
echo " detach rsync -a ./data remote:/backup/"
echo "$c_head""Example:$c_reset"
echo " $c_cmd""detach$c_reset firefox"
echo " $c_cmd""detach$c_reset rsync -a ./data remote:/backup/"
return
end
+12 -7
View File
@@ -38,14 +38,19 @@ 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"
echo "Usage: dng2avif [options] [input.dng]"
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)
echo "$c_head""Usage:$c_reset $c_cmd""dng2avif$c_reset $c_flag""[options]$c_reset $c_dim""[input.dng]$c_reset"
echo ""
echo "Options:"
echo " -i, --input FILE Input DNG file"
echo " -o, --output FILE Output AVIF file (defaults to input name)"
echo " -q, --quality N Encoding quality 0-100 (default: 92)"
echo " -s, --speed N Encoder speed 0-10 (default: 3, 0=slowest)"
echo " -h, --help Show this help message"
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-h$c_reset, $c_flag--help$c_reset Show this help message"
return 0
end
+10 -5
View File
@@ -30,13 +30,18 @@ function dockup --description 'Pull and restart docker compose containers'
# Handle help flags
if contains -- -h $argv; or contains -- --help $argv
echo (set_color -o yellow)"Usage:"$clr_off" dockup [DIRECTORY]"
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)
echo "$c_head""Usage:$c_reset $c_cmd""dockup$c_reset $c_dim""[DIRECTORY]$c_reset"
echo ""
echo (set_color -u)"Options:"$clr_off
echo " -h, --help Show this help message"
echo "$c_head""Options:$c_reset"
echo " $c_flag-h$c_reset, $c_flag--help$c_reset Show this help message"
echo ""
echo (set_color -u)"Arguments:"$clr_off
echo " DIRECTORY Optional path to the compose project (defaults to current dir)"
echo "$c_head""Arguments:$c_reset"
echo " $c_dim""DIRECTORY$c_reset Optional path to the compose project (defaults to current dir)"
return 0
end
+1 -1
View File
@@ -46,7 +46,7 @@
# edit --text="hello world"
function edit --description 'Open files in a terminal or GUI editor with fallbacks'
set -l c_head (set_color --bold cyan)
set -l c_cmd (set_color --bold white)
set -l c_cmd (set_color --bold)
set -l c_flag (set_color yellow)
set -l c_err (set_color red)
set -l c_dim (set_color brblack)
+15 -9
View File
@@ -93,18 +93,24 @@ end
# EXAMPLE
# __fish_deps_help
function __fish_deps_help
set_color cyan; echo "fish-deps — manage fish shell dependencies"; set_color normal
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)
echo "$c_head""fish-deps$c_reset — manage fish shell dependencies"
echo ""
echo "Usage:"
echo " fish-deps [status] Check installed/missing deps (default)"
echo " fish-deps install Install missing deps interactively"
echo " fish-deps update Update all installed deps"
echo " fish-deps sync Install missing, then update all"
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 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"
echo ""
echo " install/sync accept:"
echo " --optional Also offer Optional-tier deps (skipped by default)"
echo " --terminals Also offer Terminal-Emulator-tier deps (skipped by default)"
echo " --all Shorthand for --optional --terminals"
echo " $c_flag--optional$c_reset Also offer Optional-tier deps (skipped by default)"
echo " $c_flag--terminals$c_reset Also offer Terminal-Emulator-tier deps (skipped by default)"
echo " $c_flag--all$c_reset Shorthand for --optional --terminals"
echo ""
echo "Install method priority: cargo > system PM > git/curl/pipx"
echo "When multiple methods are available, you will be prompted to choose."
+49 -49
View File
@@ -52,13 +52,13 @@
# `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 white)
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_rst (set_color normal)
set -l c_reset (set_color normal)
set -l subcmds run list attach kill logs help \
-r --run -l --list -a --attach -k --kill -o --output -h --help
@@ -104,34 +104,34 @@ function jobrunner --description 'Manage detached background jobs with tmux or G
# ╰──────────────────────────────────────────────────────────╯
# Answered before the dependency check so usage is readable anywhere.
if set -q argv[1]; and contains -- $argv[1] help -h --help
echo "$c_head""Usage:$c_rst $c_cmd""jobrunner$c_rst $c_arg""[<subcommand>] [<name>] [<command>...]$c_rst"
echo "$c_head""Usage:$c_reset $c_cmd""jobrunner$c_reset $c_arg""[<subcommand>] [<name>] [<command>...]$c_reset"
echo
echo " Run and manage named background jobs backed by tmux or GNU screen."
echo " If $c_arg<name>$c_rst is omitted, a random memorable name is generated."
echo " If $c_arg<name>$c_reset is omitted, a random memorable name is generated."
echo
echo "$c_head""Subcommands:$c_rst"
echo " $c_cmd""run$c_rst, $c_flag-r$c_rst, $c_flag--run$c_rst $c_arg""[-n <name>] <cmd>$c_rst Start a new background job"
echo " $c_cmd""list$c_rst, $c_flag-l$c_rst, $c_flag--list$c_rst List all running jobs (default)"
echo " $c_cmd""attach$c_rst, $c_flag-a$c_rst, $c_flag--attach$c_rst $c_arg""<name>$c_rst Attach to a running job's terminal"
echo " $c_cmd""kill$c_rst, $c_flag-k$c_rst, $c_flag--kill$c_rst $c_arg""<name>$c_rst Terminate a running background job"
echo " $c_cmd""logs$c_rst, $c_flag-o$c_rst, $c_flag--output$c_rst $c_arg""<name>$c_rst Print a job's current output, no attach"
echo " $c_cmd""help$c_rst, $c_flag-h$c_rst, $c_flag--help$c_rst Show usage help"
echo "$c_head""Subcommands:$c_reset"
echo " $c_cmd""run$c_reset, $c_flag-r$c_reset, $c_flag--run$c_reset $c_arg""[-n <name>] <cmd>$c_reset Start a new background job"
echo " $c_cmd""list$c_reset, $c_flag-l$c_reset, $c_flag--list$c_reset List all running jobs (default)"
echo " $c_cmd""attach$c_reset, $c_flag-a$c_reset, $c_flag--attach$c_reset $c_arg""<name>$c_reset Attach to a running job's terminal"
echo " $c_cmd""kill$c_reset, $c_flag-k$c_reset, $c_flag--kill$c_reset $c_arg""<name>$c_reset Terminate a running background job"
echo " $c_cmd""logs$c_reset, $c_flag-o$c_reset, $c_flag--output$c_reset $c_arg""<name>$c_reset Print a job's current output, no attach"
echo " $c_cmd""help$c_reset, $c_flag-h$c_reset, $c_flag--help$c_reset Show usage help"
echo
echo "$c_head""Options:$c_rst"
echo " $c_flag-t$c_rst, $c_flag--tool$c_rst $c_arg""<tool>$c_rst Force backend tool ('tmux' or 'screen')"
echo " $c_flag-n$c_rst, $c_flag--name$c_rst $c_arg""<name>$c_rst Set explicit name for a new job"
echo "$c_head""Options:$c_reset"
echo " $c_flag-t$c_reset, $c_flag--tool$c_reset $c_arg""<tool>$c_reset Force backend tool ('tmux' or 'screen')"
echo " $c_flag-n$c_reset, $c_flag--name$c_reset $c_arg""<name>$c_reset Set explicit name for a new job"
echo
echo "$c_head""Shortcuts:$c_rst"
echo " $c_cmd""jobrunner$c_rst $c_arg""<name>$c_rst $c_dim""attach <name>$c_rst"
echo " $c_cmd""jobrunner$c_rst $c_arg""[-n <name>] <cmd>...$c_rst$c_dim""run [-n <name>] <cmd>...$c_rst"
echo "$c_head""Shortcuts:$c_reset"
echo " $c_cmd""jobrunner$c_reset $c_arg""<name>$c_reset $c_dim""attach <name>$c_reset"
echo " $c_cmd""jobrunner$c_reset $c_arg""[-n <name>] <cmd>...$c_reset$c_dim""run [-n <name>] <cmd>...$c_reset"
echo
echo "$c_head""Examples:$c_rst"
echo " $c_cmd""jobrunner$c_rst $c_arg""run -n build$c_rst""$c_dim"" make -j8$c_rst"
echo " $c_cmd""jobrunner$c_rst $c_arg""sleep 1000$c_rst"
echo " $c_cmd""jobrunner$c_rst $c_arg""logs build$c_rst"
echo " $c_cmd""jobrunner$c_rst $c_arg""kill build$c_rst"
echo "$c_head""Examples:$c_reset"
echo " $c_cmd""jobrunner$c_reset $c_arg""run -n build$c_reset""$c_dim"" make -j8$c_reset"
echo " $c_cmd""jobrunner$c_reset $c_arg""sleep 1000$c_reset"
echo " $c_cmd""jobrunner$c_reset $c_arg""logs build$c_reset"
echo " $c_cmd""jobrunner$c_reset $c_arg""kill build$c_reset"
echo
echo "$c_dim""Detach from an attached job with Ctrl-A then D.$c_rst"
echo "$c_dim""Detach from an attached job with Ctrl-A then D.$c_reset"
return 0
end
@@ -140,11 +140,11 @@ function jobrunner --description 'Manage detached background jobs with tmux or G
# ╰──────────────────────────────────────────────────────────╯
if test -n "$tool"
if not contains -- $tool tmux screen
echo "$c_err""jobrunner:$c_rst invalid tool '$c_arg$tool$c_rst', must be 'tmux' or 'screen'." >&2
echo "$c_err""jobrunner:$c_reset invalid tool '$c_arg$tool$c_reset', must be 'tmux' or 'screen'." >&2
return 1
end
if not command -q $tool
echo "$c_err""jobrunner:$c_rst '$tool' is required but was not found in PATH." >&2
echo "$c_err""jobrunner:$c_reset '$tool' is required but was not found in PATH." >&2
return 127
end
else
@@ -153,7 +153,7 @@ function jobrunner --description 'Manage detached background jobs with tmux or G
else if command -q screen
set tool screen
else
echo "$c_err""jobrunner:$c_rst neither 'tmux' nor 'screen' was found in PATH." >&2
echo "$c_err""jobrunner:$c_reset neither 'tmux' nor 'screen' was found in PATH." >&2
return 127
end
end
@@ -171,8 +171,8 @@ function jobrunner --description 'Manage detached background jobs with tmux or G
set argv attach $argv
set cmd attach
else
echo "$c_err""jobrunner:$c_rst unknown subcommand or job '$c_arg$cmd$c_rst'." >&2
echo "Run $c_cmd""jobrunner --help$c_rst for usage." >&2
echo "$c_err""jobrunner:$c_reset unknown subcommand or job '$c_arg$cmd$c_reset'." >&2
echo "Run $c_cmd""jobrunner --help$c_reset for usage." >&2
return 1
end
else
@@ -207,7 +207,7 @@ function jobrunner --description 'Manage detached background jobs with tmux or G
end
if test (count $argv) -lt 2
echo "$c_head""Usage:$c_rst $c_cmd""jobrunner run$c_rst $c_arg""[-n <name>] <command>...$c_rst" >&2
echo "$c_head""Usage:$c_reset $c_cmd""jobrunner run$c_reset $c_arg""[-n <name>] <command>...$c_reset" >&2
return 1
end
@@ -218,11 +218,11 @@ function jobrunner --description 'Manage detached background jobs with tmux or G
# screen stores each session as a socket file named after it.
if string match -q '*/*' -- $name
echo "$c_err""jobrunner:$c_rst job name may not contain '/'." >&2
echo "$c_err""jobrunner:$c_reset job name may not contain '/'." >&2
return 1
end
if contains -- $name (__jobrunner_sessions $tool | string replace -r '\t.*$' '')
echo "$c_err""jobrunner:$c_rst job '$c_arg$name$c_rst' is already running." >&2
echo "$c_err""jobrunner:$c_reset job '$c_arg$name$c_reset' is already running." >&2
return 1
end
@@ -232,7 +232,7 @@ function jobrunner --description 'Manage detached background jobs with tmux or G
command screen -d -m -S $name $task
end
or begin
echo "$c_err""jobrunner:$c_rst failed to start job '$c_arg$name$c_rst'." >&2
echo "$c_err""jobrunner:$c_reset failed to start job '$c_arg$name$c_reset'." >&2
return 1
end
@@ -243,10 +243,10 @@ function jobrunner --description 'Manage detached background jobs with tmux or G
end
if set -q pid[1]
echo "$c_ok""$c_rst Started job $c_arg$name$c_rst $c_dim(PID $pid)$c_rst"
echo "$c_ok""$c_reset Started job $c_arg$name$c_reset $c_dim(PID $pid)$c_reset"
else
# The job may have finished (or failed) before we looked.
echo "$c_ok""$c_rst Started job $c_arg$name$c_rst $c_dim(already exited)$c_rst"
echo "$c_ok""$c_reset Started job $c_arg$name$c_reset $c_dim(already exited)$c_reset"
end
case list -l --list
@@ -256,21 +256,21 @@ function jobrunner --description 'Manage detached background jobs with tmux or G
return 0
end
printf '%s%-20s %-8s %-10s %s%s\n' "$c_head" JOB PID STATE STARTED "$c_rst"
printf '%s%-20s %-8s %-10s %s%s\n' "$c_head" JOB PID STATE STARTED "$c_reset"
for row in $rows
set -l f (string split \t -- $row)
printf '%s%-20s%s %-8s %-10s %s%s%s\n' \
"$c_arg" $f[1] "$c_rst" $f[2] $f[3] "$c_dim" $f[4] "$c_rst"
"$c_arg" $f[1] "$c_reset" $f[2] $f[3] "$c_dim" $f[4] "$c_reset"
end
case attach -a --attach
if test (count $argv) -ne 2
echo "$c_head""Usage:$c_rst $c_cmd""jobrunner attach$c_rst $c_arg""<name>$c_rst" >&2
echo "$c_head""Usage:$c_reset $c_cmd""jobrunner attach$c_reset $c_arg""<name>$c_reset" >&2
return 1
end
set -l name $argv[2]
if not contains -- $name (__jobrunner_sessions $tool | string replace -r '\t.*$' '')
echo "$c_err""jobrunner:$c_rst no such job '$c_arg$name$c_rst'." >&2
echo "$c_err""jobrunner:$c_reset no such job '$c_arg$name$c_reset'." >&2
return 1
end
if test "$tool" = tmux
@@ -282,12 +282,12 @@ function jobrunner --description 'Manage detached background jobs with tmux or G
case kill -k --kill
if test (count $argv) -ne 2
echo "$c_head""Usage:$c_rst $c_cmd""jobrunner kill$c_rst $c_arg""<name>$c_rst" >&2
echo "$c_head""Usage:$c_reset $c_cmd""jobrunner kill$c_reset $c_arg""<name>$c_reset" >&2
return 1
end
set -l name $argv[2]
if not contains -- $name (__jobrunner_sessions $tool | string replace -r '\t.*$' '')
echo "$c_err""jobrunner:$c_rst no such job '$c_arg$name$c_rst'." >&2
echo "$c_err""jobrunner:$c_reset no such job '$c_arg$name$c_reset'." >&2
return 1
end
if test "$tool" = tmux
@@ -296,19 +296,19 @@ function jobrunner --description 'Manage detached background jobs with tmux or G
command screen -X -S $name quit
end
or begin
echo "$c_err""jobrunner:$c_rst failed to terminate job '$c_arg$name$c_rst'." >&2
echo "$c_err""jobrunner:$c_reset failed to terminate job '$c_arg$name$c_reset'." >&2
return 1
end
echo "$c_ok""$c_rst Terminated job $c_arg$name$c_rst"
echo "$c_ok""$c_reset Terminated job $c_arg$name$c_reset"
case logs -o --output
if test (count $argv) -ne 2
echo "$c_head""Usage:$c_rst $c_cmd""jobrunner logs$c_rst $c_arg""<name>$c_rst" >&2
echo "$c_head""Usage:$c_reset $c_cmd""jobrunner logs$c_reset $c_arg""<name>$c_reset" >&2
return 1
end
set -l name $argv[2]
if not contains -- $name (__jobrunner_sessions $tool | string replace -r '\t.*$' '')
echo "$c_err""jobrunner:$c_rst no such job '$c_arg$name$c_rst'." >&2
echo "$c_err""jobrunner:$c_reset no such job '$c_arg$name$c_reset'." >&2
return 1
end
@@ -317,7 +317,7 @@ function jobrunner --description 'Manage detached background jobs with tmux or G
# capture-pane -S - -p outputs the scrollback and current pane directly to stdout.
set out (command tmux capture-pane -t $name -S - -p)
or begin
echo "$c_err""jobrunner:$c_rst could not read output of '$c_arg$name$c_rst'." >&2
echo "$c_err""jobrunner:$c_reset could not read output of '$c_arg$name$c_reset'." >&2
return 1
end
else
@@ -328,7 +328,7 @@ function jobrunner --description 'Manage detached background jobs with tmux or G
command screen -X -S $name hardcopy -h $dump
or begin
command rm -f $dump
echo "$c_err""jobrunner:$c_rst could not read output of '$c_arg$name$c_rst'." >&2
echo "$c_err""jobrunner:$c_reset could not read output of '$c_arg$name$c_reset'." >&2
return 1
end
@@ -343,12 +343,12 @@ function jobrunner --description 'Manage detached background jobs with tmux or G
if set -q out[1]
printf '%s\n' $out
else
echo "$c_dim(no output yet)$c_rst"
echo "$c_dim(no output yet)$c_reset"
end
case '*'
echo "$c_err""jobrunner:$c_rst invalid subcommand '$c_arg$cmd$c_rst'." >&2
echo "Run $c_cmd""jobrunner --help$c_rst for usage." >&2
echo "$c_err""jobrunner:$c_reset invalid subcommand '$c_arg$cmd$c_reset'." >&2
echo "Run $c_cmd""jobrunner --help$c_reset for usage." >&2
return 1
end
end
+1 -1
View File
@@ -39,7 +39,7 @@
# 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 white)
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)
+1 -1
View File
@@ -27,7 +27,7 @@
# mkcd ~/projects/newapp/src
function mkcd --description 'Create a directory (with parents) and cd into it'
set -l c_head (set_color --bold cyan)
set -l c_cmd (set_color --bold white)
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)
+13 -5
View File
@@ -41,16 +41,24 @@
# NOTES
# Typo abbreviation: url-open (expands to open-url on space/enter).
function open-url --description 'Open a URL in the best available web browser'
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_arg (set_color cyan)
set -l c_reset (set_color normal)
argparse h/help s/silent v/verbose -- $argv
or return 1
if set -q _flag_help
echo "Usage: open-url [-s|--silent] [-v|--verbose] <url>"
echo "Open a URL or file:// URI in the best available web browser."
echo "$c_head""Usage:$c_reset $c_cmd""open-url$c_reset $c_flag""[-s|--silent] [-v|--verbose]$c_reset $c_arg""<url>$c_reset"
echo
echo " -s, --silent Suppress success output (the default)"
echo " -v, --verbose Print which browser is being launched"
echo " -h, --help Show this help"
echo " Open a URL or file:// URI in the best available web browser."
echo
echo "$c_head""Options:$c_reset"
echo " $c_flag-s$c_reset, $c_flag--silent$c_reset Suppress success output (the default)"
echo " $c_flag-v$c_reset, $c_flag--verbose$c_reset Print which browser is being launched"
echo " $c_flag-h$c_reset, $c_flag--help$c_reset Show this help"
return 0
end
+11 -7
View File
@@ -28,16 +28,20 @@
function p --description 'Put from clipboard'
# Check for help flag
if contains -- -h $argv; or contains -- --help $argv
echo "Usage: p [OPTIONS]"
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)
echo "$c_head""Usage:$c_reset $c_cmd""p$c_reset $c_flag""[OPTIONS]$c_reset"
echo ""
echo "Description:"
echo " Pastes content from the system clipboard to stdout."
echo ""
echo "Examples:"
echo " p Print clipboard content"
echo " p > file.txt Save clipboard to a file"
echo " p | grep 'foo' Pipe clipboard content to another command"
echo " cat (p) Use clipboard content as a filename for cat"
echo "$c_head""Examples:$c_reset"
echo " $c_cmd""p$c_reset "$c_dim"Print clipboard content"$c_reset
echo " $c_cmd""p$c_reset > file.txt "$c_dim"Save clipboard to a file"$c_reset
echo " $c_cmd""p$c_reset | grep 'foo' "$c_dim"Pipe clipboard content to another command"$c_reset
echo " cat ($c_cmd""p$c_reset) "$c_dim"Use clipboard content as a filename for cat"$c_reset
return 0
end
+1 -1
View File
@@ -47,7 +47,7 @@ function pkg --description 'Install or remove packages via the system package ma
# ── Colour palette ───────────────────────────────────────────
set -l c_head (set_color --bold cyan)
set -l c_cmd (set_color --bold white)
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)
+12 -4
View File
@@ -36,15 +36,23 @@
# play-media
# play-media --player mpv
function play-media --description 'Pick audio/video files with fzf and play them'
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)
argparse h/help p/player= -- $argv
or return 1
if set -q _flag_help
echo "Usage: play-media [-p|--player <cmd>]"
echo "Pick audio/video files under the current directory with fzf and play them."
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
echo " -p, --player <cmd> Force a specific player command"
echo " -h, --help Show this help"
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-h$c_reset, $c_flag--help$c_reset Show this help"
return 0
end
+1 -1
View File
@@ -33,7 +33,7 @@ if type -q aichat
function qc --wraps aichat --description 'Quick-chat wrapper around aichat (cli role)'
if contains -- -h $argv; or contains -- --help $argv
set -l c_ttl (set_color --bold cyan)
set -l c_cmd (set_color --bold white)
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)
+1 -1
View File
@@ -39,7 +39,7 @@
# much faster for files with >1000 lines.
function rand_string --description 'Generate random, memorable strings from curated word databases'
set -l c_head (set_color --bold cyan)
set -l c_cmd (set_color --bold white)
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)
+9 -4
View File
@@ -27,10 +27,15 @@ function replay --description 'Run Bash commands replaying changes in Fish'
case -v --version
echo "replay, version 1.2.1"
case "" -h --help
echo "Usage: replay <commands> Run Bash commands replaying changes in Fish"
echo "Options:"
echo " -v or --version Print version"
echo " -h or --help Print this help message"
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_arg (set_color cyan)
set -l c_reset (set_color normal)
echo "$c_head""Usage:$c_reset $c_cmd""replay$c_reset $c_arg""<commands>$c_reset Run Bash commands replaying changes in Fish"
echo "$c_head""Options:$c_reset"
echo " $c_flag-v$c_reset or $c_flag--version$c_reset Print version"
echo " $c_flag-h$c_reset or $c_flag--help$c_reset Print this help message"
case \*
set --local env
set --local sep @$fish_pid(random)(command date +%s)
+12 -6
View File
@@ -52,17 +52,23 @@
# NOTES
# Typo abbreviation: open-repo (expands to repo-open on space/enter).
function repo-open --description 'Open the origin remote of the current repo in a browser'
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)
argparse -X 0 h/help p/print r/root -- $argv
or return 1
if set -q _flag_help
echo "Usage: repo-open [-p|--print] [-r|--root]"
echo "Open the origin remote's web page for the current repo,"
echo "deep-linking to the current branch and sub-directory."
echo "$c_head""Usage:$c_reset $c_cmd""repo-open$c_reset $c_flag""[-p|--print] [-r|--root]$c_reset"
echo " Open the origin remote's web page for the current repo,"
echo " deep-linking to the current branch and sub-directory."
echo
echo " -p, --print Print the URL instead of opening it"
echo " -r, --root Link to the repo root, ignoring the current sub-directory"
echo " -h, --help Show this help"
echo "$c_head""Options:$c_reset"
echo " $c_flag-p$c_reset, $c_flag--print$c_reset Print the URL instead of opening it"
echo " $c_flag-r$c_reset, $c_flag--root$c_reset Link to the repo root, ignoring the current sub-directory"
echo " $c_flag-h$c_reset, $c_flag--help$c_reset Show this help"
return 0
end
+11 -6
View File
@@ -63,14 +63,19 @@ function scrub --description 'Recursively purge OS, editor, and compiler garbage
# Helper function for help menu text
function _scrub_help
echo (set_color --bold cyan)"Usage:"(set_color normal) "scrub [options]"
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)
echo "$c_head""Usage:$c_reset $c_cmd""scrub$c_reset $c_flag""[options]$c_reset"
echo
echo (set_color --bold cyan)"Options:"(set_color normal)
echo " -a, --aggressive Purge advanced development artifacts, logs, and heavyweight caches"
echo " -d, --dry-run Show files/folders that would be targeted without removing them"
echo " -h, --help Display this help menu"
echo "$c_head""Options:$c_reset"
echo " $c_flag-a$c_reset, $c_flag--aggressive$c_reset Purge advanced development artifacts, logs, and heavyweight caches"
echo " $c_flag-d$c_reset, $c_flag--dry-run$c_reset Show files/folders that would be targeted without removing them"
echo " $c_flag-h$c_reset, $c_flag--help$c_reset Display this help menu"
echo
echo (set_color --bold cyan)"Standard Targets:"(set_color normal)
echo "$c_head""Standard Targets:$c_reset"
echo " • OS Metadata: .DS_Store, ._* (AppleDouble), Thumbs.db, .directory (KDE)"
echo " • Editors: *.swp, *.swo (Vim/Nvim), .netrwhist"
echo " • Dev Caches: __pycache__, .pytest_cache, .turbo, *-debug.log"
+15 -10
View File
@@ -29,16 +29,21 @@ function spark --description 'Sparklines'
if set --query _flag_version[1]
echo "spark, version 1.1.0"
else if set --query _flag_help[1]
echo "Usage: spark <numbers ...>"
echo " stdin | spark"
echo "Options:"
echo " --min=<number> Minimum range"
echo " --max=<number> Maximum range"
echo " -v or --version Print version"
echo " -h or --help Print this help message"
echo "Examples:"
echo " spark 1 1 2 5 14 42"
echo " seq 64 | sort --random-sort | spark"
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_arg (set_color cyan)
set -l c_reset (set_color normal)
echo "$c_head""Usage:$c_reset $c_cmd""spark$c_reset $c_arg""<numbers ...>$c_reset"
echo " stdin | $c_cmd""spark$c_reset"
echo "$c_head""Options:$c_reset"
echo " $c_flag--min$c_reset""=$c_arg<number>$c_reset Minimum range"
echo " $c_flag--max$c_reset""=$c_arg<number>$c_reset Maximum range"
echo " $c_flag-v$c_reset or $c_flag--version$c_reset Print version"
echo " $c_flag-h$c_reset or $c_flag--help$c_reset Print this help message"
echo "$c_head""Examples:$c_reset"
echo " $c_cmd""spark$c_reset 1 1 2 5 14 42"
echo " seq 64 | sort --random-sort | $c_cmd""spark$c_reset"
else if set --query argv[1]
printf "%s\n" $argv | spark --min="$_flag_min" --max="$_flag_max"
else
+5 -1
View File
@@ -23,7 +23,11 @@
# wake-lock rsync -avz src/ dest/
function wake-lock --description 'Run a command while inhibiting system sleep'
if test (count $argv) -eq 0
echo "Usage: wake-lock [command] [args...]"
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)
echo "$c_head""Usage:$c_reset $c_cmd""wake-lock$c_reset $c_arg""[command] [args...]$c_reset"
return 1
end
+11 -6
View File
@@ -25,13 +25,18 @@
function y --description 'Yank to clipboard'
# Check for help flag
if contains -- -h $argv; or contains -- --help $argv
echo "Usage: y [TEXT] or [COMMAND] | y"
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_dim (set_color brblack)
set -l c_reset (set_color normal)
echo "$c_head""Usage:$c_reset $c_cmd""y$c_reset $c_arg""[TEXT]$c_reset or $c_arg""[COMMAND]$c_reset | $c_cmd""y$c_reset"
echo ""
echo "Examples:"
echo " y \"hello world\" Copy a string directly"
echo " ls | y Copy output of a command"
echo " y < file.txt Copy contents of a file"
echo " cat file.txt | y Another way to copy a file"
echo "$c_head""Examples:$c_reset"
echo " $c_cmd""y$c_reset \"hello world\" "$c_dim"Copy a string directly"$c_reset
echo " ls | $c_cmd""y$c_reset "$c_dim"Copy output of a command"$c_reset
echo " $c_cmd""y$c_reset < file.txt "$c_dim"Copy contents of a file"$c_reset
echo " cat file.txt | $c_cmd""y$c_reset "$c_dim"Another way to copy a file"$c_reset
return 0
end