Simplify options array

This commit is contained in:
cryobry
2020-05-09 13:47:32 -04:00
parent 55aea4774a
commit 903eb8dcdb

View File

@@ -98,7 +98,7 @@ EOF
;;
--options|-o)
shift
_options="$1"
_options+=("$1")
;;
--image|-i)
shift
@@ -155,16 +155,13 @@ EOF
return
fi
# Parse podman options
# Parse podman options from --optionsarray
if [[ -n $_opts_arr ]]; then
# namerefs are awesome
declare -gn _prw_opts_arr="$_opts_arr"
# If not array mode optionally load podman options from input string
elif [[ -n $_options ]]; then
declare -ga _prw_opts_arr
for _option in $_options; do
_prw_opts_arr+=("$_option")
done
# If no array given, parse input from options
elif [[ ${#_options[@]} -ge 1 ]]; then
declare -ga _prw_opts_arr=("${_options[@]}")
else
echo "Must provide --options or the name of an existing --optionsarray"
_printHelpAndExit 1