Explorar o código

Simplify options array

cryobry %!s(int64=5) %!d(string=hai) anos
pai
achega
903eb8dcdb
Modificáronse 1 ficheiros con 5 adicións e 8 borrados
  1. 5 8
      plugins/podmanRun/podmanRunWrapper

+ 5 - 8
plugins/podmanRun/podmanRunWrapper

@@ -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