debug should always last argument

This commit is contained in:
Kay Marquardt (Gnadelwartz) 2020-07-10 08:39:33 +02:00
parent d85c7794a9
commit 9799db4cb9

View File

@ -11,7 +11,7 @@
# This file is public domain in the USA and all free countries. # This file is public domain in the USA and all free countries.
# Elsewhere, consider it to be WTFPLv2. (wtfpl.net/txt/copying) # Elsewhere, consider it to be WTFPLv2. (wtfpl.net/txt/copying)
# #
#### $$VERSION$$ v0.98-0-g487deee #### $$VERSION$$ v0.99-dev-1-gd85c779
# #
# Exit Codes: # Exit Codes:
# - 0 success (hopefully) # - 0 success (hopefully)
@ -75,9 +75,10 @@ log_error(){
printf"%s: %s\n" "$(date)" "$*" >>"${ERRORLOG}" printf"%s: %s\n" "$(date)" "$*" >>"${ERRORLOG}"
} }
# additional tests if we run in debug mode # additional tests if we run in debug mode
# $1 where $2 command $3 may debug
export BASHBOTDEBUG export BASHBOTDEBUG
[[ "${3}" == *"debug"* ]] && BASHBOTDEBUG="yes" # debug should always last argument
[[ "${BASH_ARGV[0]}" == *"debug"* ]] && BASHBOTDEBUG="yes"
# $1 where $2 command $3 may debug
debug_checks(){ debug_checks(){
[ -z "${BASHBOTDEBUG}" ] && return [ -z "${BASHBOTDEBUG}" ] && return
local DATE WHERE MYTOKEN; DATE="$(date)"; WHERE="${1}"; shift local DATE WHERE MYTOKEN; DATE="$(date)"; WHERE="${1}"; shift