mirror of
https://github.com/natelandau/shell-scripting-templates.git
synced 2025-11-11 14:33:47 -05:00
_printArray_: only print in verbose mode
This commit is contained in:
@@ -38,7 +38,7 @@ _printAnsi_() {
|
||||
|
||||
_printArray_() {
|
||||
# DESC:
|
||||
# Prints the content of array as key value pairs for easier debugging
|
||||
# Prints the content of array as key value pairs for easier debugging. Only prints in verbose mode.
|
||||
# ARGS:
|
||||
# $1 (Required) - String variable name of the array
|
||||
# OUTS:
|
||||
@@ -53,8 +53,10 @@ _printArray_() {
|
||||
|
||||
local _arrayName="${1}"
|
||||
declare -n _arr="${1}"
|
||||
printf "${underline}Printing contents of \${%s${reset}[@]}\n" "${_arrayName}"
|
||||
[[ ${VERBOSE} != true ]] && return 0
|
||||
debug "Printing contents of \${${_arrayName}[@]}"
|
||||
|
||||
for _k in "${!_arr[@]}"; do
|
||||
printf "%s = %s\n" "$_k" "${_arr[$_k]}"
|
||||
debug "${_k} = ${_arr[$_k]}"
|
||||
done
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user