mirror of
https://github.com/natelandau/shell-scripting-templates.git
synced 2025-11-13 07:23:47 -05:00
add tests
This commit is contained in:
@@ -149,3 +149,20 @@ die() { _alert_ fatal "${1}" "${2-}"; _safeExit_ "1" ; }
|
||||
fatal() { _alert_ fatal "${1}" "${2-}"; _safeExit_ "1" ; }
|
||||
debug() { _alert_ debug "${1}" "${2-}"; }
|
||||
verbose() { _alert_ debug "${1}" "${2-}"; }
|
||||
|
||||
_functionStack_() {
|
||||
# DESC: Prints the function stack in use
|
||||
# ARGS: None
|
||||
# OUTS: Prints [function]:[file]:[line]
|
||||
# NOTE: Does not print functions from the alert class
|
||||
local _i
|
||||
funcStackResponse=()
|
||||
for ((_i = 1; _i < ${#BASH_SOURCE[@]}; _i++)); do
|
||||
case "${FUNCNAME[$_i]}" in "_alert_" | "_trapCleanup_" | fatal | error | warning | verbose | debug | die) continue ;; esac
|
||||
funcStackResponse+=("${FUNCNAME[$_i]}:$(basename ${BASH_SOURCE[$_i]}):${BASH_LINENO[$_i - 1]}")
|
||||
done
|
||||
printf "( "
|
||||
printf %s "${funcStackResponse[0]}"
|
||||
printf ' < %s' "${funcStackResponse[@]:1}"
|
||||
printf ' )\n'
|
||||
}
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
|
||||
_inArray_() {
|
||||
# DESC: Determine if a value is in an array
|
||||
# ARGS: $1 (Required) - Value to search for
|
||||
@@ -74,7 +75,7 @@ _removeDupes_() {
|
||||
# DESC: Removes duplicate array elements.
|
||||
# ARGS: $1 (Required) - Input array
|
||||
# OUTS: Prints de-duped elements to standard out
|
||||
# USAGE: _removeDups_ "${array@]}"
|
||||
# USAGE: _removeDups_ "${array[@]}"
|
||||
# NOTE: List order may not stay the same.
|
||||
# https://github.com/dylanaraps/pure-bash-bible
|
||||
declare -A tmp_array
|
||||
|
||||
Reference in New Issue
Block a user