aboutsummaryrefslogtreecommitdiff
path: root/devscripts
diff options
context:
space:
mode:
Diffstat (limited to '')
-rwxr-xr-xdevscripts/release.sh62
1 files changed, 31 insertions, 31 deletions
diff --git a/devscripts/release.sh b/devscripts/release.sh
index d95adb3..0fda106 100755
--- a/devscripts/release.sh
+++ b/devscripts/release.sh
@@ -68,6 +68,7 @@ set -o pipefail
# and for informational messages. They are marked readonly to prevent
# accidental modification at runtime.
###############################################################################
+
readonly SCRIPTNAME=${0##*/}
readonly DESCRIPTION="Release helper for transcode.sh."
readonly DATE_OF_CREATION=2026-05-15
@@ -114,12 +115,8 @@ EXIT_CONFIG_ERROR=3
EXIT_MISSING_DEPENDENCY=127
readonly EXIT_OK EXIT_RUNTIME_FAILURE EXIT_USAGE_ERROR EXIT_CONFIG_ERROR EXIT_MISSING_DEPENDENCY
-##############################################################################
-# FUNCTIONS
-#
-# This section defines the helper functions used throughout the script. They
-# handle formatted output, error reporting, version information, utility
-# functions and runtime behaviour such as displaying usage instructions.
+###############################################################################
+# OUTPUT HELPERS
###############################################################################
emit() {
@@ -176,6 +173,10 @@ debug() {
fi
}
+###############################################################################
+# HELP AND VERSION OUTPUT
+###############################################################################
+
print_help() {
printf "${BOLD}${MAGENTA}%s${ALL_OFF} - ${BOLD}${CYAN}%s${ALL_OFF} - ${BOLD}%s${ALL_OFF}
@@ -252,35 +253,17 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n" \
}
###############################################################################
-# TERMINAL COLOR SETUP
+# TERMINAL COLOR HANDLING
#
# Colors and style escape sequences are configured dynamically through the
-# `setup_colors` function, which enables or disables color output based on
-# the value of ENABLE_COLOR. When enabled, terminal capabilities are detected
-# via `tput`, falling back to ANSI escapes if unavailable.
+# setup_colors function. Runtime color detection happens in MAIN EXECUTION so
+# all function definitions stay together before the executable flow.
#
-# This script respects the NO_COLOR standard (https://no-color.org/).
-# If the environment variable NO_COLOR is set (to any value), all color output
-# is disabled. If FORCE_COLOR is set, colors are always enabled.
+# This script respects the NO_COLOR standard (https://no-color.org/). If the
+# environment variable NO_COLOR is set (to any value), all color output is
+# disabled. If FORCE_COLOR is set, colors are always enabled.
###############################################################################
-# NOTE: This block calls debug() and reads $DEBUG. Both must be defined before
-# this point. Do not move this block above the GLOBAL VARIABLES or FUNCTIONS
-# sections without adjusting those dependencies.
-if [[ -n "${NO_COLOR:-}" ]]; then
- debug "Colors are disabled via NO_COLOR"
- ENABLE_COLOR=0
-elif [[ -n "${FORCE_COLOR:-}" ]]; then
- debug "Colors are forced via FORCE_COLOR"
- ENABLE_COLOR=1
-elif [[ -t 1 ]]; then
- debug "Colors are enabled via interactive terminal"
- ENABLE_COLOR=1
-else
- debug "Colors are disabled"
- ENABLE_COLOR=0
-fi
-
setup_colors() {
if [[ "$ENABLE_COLOR" -eq 1 ]]; then
if tput setaf 0 >/dev/null 2>&1; then
@@ -317,7 +300,6 @@ setup_colors() {
CYAN=""
fi
}
-setup_colors
###############################################################################
# RELEASE HELPERS
@@ -596,6 +578,24 @@ release() {
# MAIN EXECUTION
###############################################################################
+# NOTE: This block calls debug() and reads $DEBUG. Both must be defined before
+# this point. Do not move this block above the GLOBAL VARIABLES or FUNCTIONS
+# sections without adjusting those dependencies.
+if [[ -n "${NO_COLOR:-}" ]]; then
+ debug "Colors are disabled via NO_COLOR"
+ ENABLE_COLOR=0
+elif [[ -n "${FORCE_COLOR:-}" ]]; then
+ debug "Colors are forced via FORCE_COLOR"
+ ENABLE_COLOR=1
+elif [[ -t 1 ]]; then
+ debug "Colors are enabled via interactive terminal"
+ ENABLE_COLOR=1
+else
+ debug "Colors are disabled"
+ ENABLE_COLOR=0
+fi
+setup_colors
+
if [[ $# -eq 0 ]]; then
debug "No parameters were specified"
printf "${BOLD}${BLUE}Usage:${ALL_OFF} ${BOLD}${MAGENTA}%s${ALL_OFF} ${BOLD}${YELLOW}[OPTION]...${ALL_OFF} ${BOLD}${GREEN}COMMAND VERSION${ALL_OFF}