From 7fac550d3e95c634d8151979f263c16d2d8ddc81 Mon Sep 17 00:00:00 2001 From: Stephen Gallagher Date: Thu, 27 Apr 2023 08:58:13 -0400 Subject: [PATCH] nodejs-sources.sh: Add --debug flag Signed-off-by: Stephen Gallagher --- nodejs-sources.sh | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/nodejs-sources.sh b/nodejs-sources.sh index 41eb299..52cfe9a 100755 --- a/nodejs-sources.sh +++ b/nodejs-sources.sh @@ -5,6 +5,7 @@ # ARG_POSITIONAL_SINGLE([version],[Node.js release version]) # ARG_OPTIONAL_BOOLEAN([push],[],[Whether to upload to the lookaside cache],[on]) +# ARG_OPTIONAL_BOOLEAN([debug],[],[Print all commands],[off]) # ARG_DEFAULTS_POS([]) # ARG_HELP([Tool to aid in Node.js packaging of new releases]) # ARGBASH_GO() @@ -35,14 +36,16 @@ _positionals=() _arg_version= # THE DEFAULTS INITIALIZATION - OPTIONALS _arg_push="on" +_arg_debug="off" print_help() { printf '%s\n' "Tool to aid in Node.js packaging of new releases" - printf 'Usage: %s [--(no-)push] [-h|--help] \n' "$0" + printf 'Usage: %s [--(no-)push] [--(no-)debug] [-h|--help] \n' "$0" printf '\t%s\n' ": Node.js release version" printf '\t%s\n' "--push, --no-push: Whether to upload to the lookaside cache (on by default)" + printf '\t%s\n' "--debug, --no-debug: Print all commands (off by default)" printf '\t%s\n' "-h, --help: Prints help" } @@ -58,6 +61,10 @@ parse_commandline() _arg_push="on" test "${1:0:5}" = "--no-" && _arg_push="off" ;; + --no-debug|--debug) + _arg_debug="on" + test "${1:0:5}" = "--no-" && _arg_debug="off" + ;; -h|--help) print_help exit 0 @@ -108,6 +115,10 @@ assign_positional_args 1 "${_positionals[@]}" ### END OF CODE GENERATED BY Argbash (sortof) ### ]) # [ <-- needed because of Argbash +if [ $_arg_debug = 'on' ]; then + set -x +fi + SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" alias wget='wget --quiet'