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:
+11
-6
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user