Establish proper priority of option sources

This commit is contained in:
Nick Chambers 2021-11-06 03:45:52 -05:00
parent bc88492ac1
commit 52697be100
1 changed files with 3 additions and 3 deletions

6
rowbot
View File

@ -50,12 +50,12 @@ get_option() {
local env_var=${var_name^^}
if [[ ! -v config[$1] || -v OPT_OW ]]; then
if [[ -v $var_name ]]; then
config[$1]=${!var_name}
elif [[ -v $env_var ]]; then
if [[ -v $env_var ]]; then
config[$1]=${!env_var}
elif [[ -v opts[$1] ]]; then
config[$1]=${opts[$1]}
elif [[ -v $var_name ]]; then
config[$1]=${!var_name}
elif (( $# > 1 )); then
config[$1]=$2
fi