diff --git a/default.config b/default.config index 2831591..27bb52c 100644 --- a/default.config +++ b/default.config @@ -26,6 +26,7 @@ #CurlRetryDelay=1 # Time between curl retries #CurlRetryCount=3 # Max number of curl retries #CurlConnectTimeout=5 # Time to wait for curl to establish a connection before failing +#DisplaySourcedFiles=false # Display what files are being sourced/used ### Notify settings ## All commented values are examples only. Modify as needed. diff --git a/dockcheck.sh b/dockcheck.sh index d341ce9..183027c 100755 --- a/dockcheck.sh +++ b/dockcheck.sh @@ -14,16 +14,18 @@ ScriptPath="$(readlink -f "$0")" ScriptWorkDir="$(dirname "$ScriptPath")" # Source helper functions -source_if_exists() { - if [[ -s "$1" ]]; then source "$1"; fi -} - source_if_exists_or_fail() { - [[ -s "$1" ]] && source "$1" + if [[ -s "$1" ]]; then + source "$1" + [[ "${DisplaySourcedFiles:-false}" == true ]] && echo " * sourced config: ${1}" + return 0 + else + return 1 + fi } # User customizable defaults -source_if_exists_or_fail "${HOME}/.config/dockcheck.config" || source_if_exists "${ScriptWorkDir}/dockcheck.config" +source_if_exists_or_fail "${HOME}/.config/dockcheck.config" || source_if_exists_or_fail "${ScriptWorkDir}/dockcheck.config" # Help Function Help() {