diff --git a/rowbot b/rowbot index c4e68e2..342e149 100755 --- a/rowbot +++ b/rowbot @@ -120,6 +120,35 @@ die() { exit "${STATUS:-42}" } +get_option() { + if (( $# != 2 )); then + return 1 + fi + + local option_name=${1//-/_} + declare -n option_var=$option_name + + if [[ -v opts[$1] ]]; then + option_var=${opts[log-level]} + elif [[ ! -v $option_name ]]; then + # This variable is only used for assignment. + # shellcheck disable=SC2034 + option_var=$2 + fi +} + +has() { + if (( $# )); then + hash "$1" 2>/dev/null + else + return 1 + fi +} + +is_parent() { + (( BASHPID == $$ )) +} + is_reloaded() { [[ $RELOADED = yes ]] || (( LORE_LIVES > 1 )) }