allow output to STDOUT via cmdline

This commit is contained in:
2026-08-21 18:32:18 -05:00
parent 8c9a79c07a
commit 76d0fe843a
+14 -4
View File
@@ -8,6 +8,7 @@ SCRIPT_NAME="$(basename "${0}")"
GIT_REPO_BRANCH="${GIT_REPO_BRANCH:-production}"
OIC_FLAG="--only-if-changed"
VERBOSE_FLAG="--verbose"
DEBUG_FLAG="false"
# - Process command line
while [ $# -gt 0 ]; do
@@ -16,6 +17,11 @@ while [ $# -gt 0 ]; do
echo "Usage: $0 [--branch <branch name>]"
exit 0
;;
-d|--debug)
VERBOSE_FLAG="-vvvv"
DEBUG_FLAG="true"
shift 1
;;
-b|--branch)
shift 1
if [ $# -eq 0 ] ; then echo "${SCRIPT_NAME}: ERROR - Branch not specified." ; exit 1 ; fi
@@ -23,12 +29,12 @@ while [ $# -gt 0 ]; do
shift 1
;;
-f|--force)
shift 1
OIC_FLAG=""
shift 1
;;
-q|--quiet)
shift 1
VERBOSE_FLAG=""
shift 1
;;
--)
shift 1
@@ -61,8 +67,12 @@ if ! flock -n 9 ; then
exit 11
fi
# - Append all further STDOUT and STDERR to the log file
exec >>"${LOG_FILE}" 2>&1
# - If debugging requested or running from a terminal . . .
if [ "${DEBUG_FLAG}" = "true" || test -t 1 ] ; then
exec > >(tee -a "${LOG_FILE}") 2>&1 # - send STDOUT and STDERR to both STDOUT and the log file
else
exec >>"${LOG_FILE}" 2>&1 # - send STDOUT and STDERR to the log file only
fi
# - Log that we've gotten this far
echo