feat(common): DESCRIBE_TERM_START, _END

This commit is contained in:
Joshua A. Horton 2022-09-20 08:30:33 +07:00
parent 18c5fae23b
commit 4399548df0
2 changed files with 10 additions and 6 deletions

View file

@ -26,16 +26,13 @@ trap action_failure err
################################ Main script ################################
c1="${COLOR_BLUE:=<}"
c0="${COLOR_RESET:=>}"
builder_describe \
"Compiles the web-oriented utility function module." \
configure \
clean \
build \
test \
"--ci For use with ${c1}test${c0} action - emits CI-friendly test reports"
"--ci For use with action ${DESCRIBE_TERM_START}test${DESCRIBE_TERM_END} - emits CI-friendly test reports"
builder_parse "$@"

View file

@ -300,6 +300,11 @@ builder_use_color() {
COLOR_RESET=
HEADING_SETMARK=
fi
# Used by `builder_display_usage` when marking special terms (actions, targets, options)
# in the plain-text description area.
DESCRIBE_TERM_START="${COLOR_BLUE:=<}"
DESCRIBE_TERM_END="${COLOR_RESET:=>}"
}
if [[ -n "$TERM" ]] && [[ "$TERM" != "dumb" ]] && [[ "$TERM" != "unknown" ]]; then
@ -721,8 +726,10 @@ builder_display_usage() {
_builder_pad $width " --color" "Force colorized output"
_builder_pad $width " --no-color" "Never use colorized output"
_builder_pad $width " --help, -h" "Show this help"
local c1="${COLOR_BLUE:=<}"
local c0="${COLOR_RESET:=>}"
# Defined in `builder_use_color`; this assumes that said func has been called.
local c1=$DESCRIBE_TERM_START
local c0=$DESCRIBE_TERM_END
echo
echo "* Specify ${c1}action:target${c0} to run a specific ${c1}action${c0} against a specific ${c1}:target${c0}."
echo "* If ${c1}action${c0} is specified without a ${c1}target${c0} suffix, it will be applied to all ${c1}:target${c0}s."