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