From 4399548df01b7caa67758cd60157b97a3f19ecc9 Mon Sep 17 00:00:00 2001 From: "Joshua A. Horton" Date: Tue, 20 Sep 2022 08:30:33 +0700 Subject: [PATCH] feat(common): DESCRIBE_TERM_START, _END --- common/web/keyboard-processor/build.sh | 5 +---- resources/build/build-utils.sh | 11 +++++++++-- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/common/web/keyboard-processor/build.sh b/common/web/keyboard-processor/build.sh index 7c726c5f23..e1bf933924 100755 --- a/common/web/keyboard-processor/build.sh +++ b/common/web/keyboard-processor/build.sh @@ -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 "$@" diff --git a/resources/build/build-utils.sh b/resources/build/build-utils.sh index 9a26531bf7..ef436ebebc 100755 --- a/resources/build/build-utils.sh +++ b/resources/build/build-utils.sh @@ -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."