Close #11 : This does, indeed, fix the big janky naming bug

This commit is contained in:
2014-05-19 16:30:07 -07:00
parent a5b412f29b
commit 15ed92d390

View File

@@ -177,14 +177,11 @@ function cmdarg_set_opt
eval "${arrname}[$((prevlen + 1))]=\"$arg\"" eval "${arrname}[$((prevlen + 1))]=\"$arg\""
;; ;;
$CMDARG_TYPE_HASH) $CMDARG_TYPE_HASH)
arrname="${key}" local arrname=${key}
# Want to know WTF I named this variable like this? declare -gA -- "$arrname"
# http://stackoverflow.com/questions/10258686/bash-associative-array-error local k=${arg%%=*}
# ... Apparently there is a bug in bash. local v=${arg#*=}
cmdarghashkeythingy31337=$(echo "$arg" | cut -d = -f 1) eval "$arrname[\$k]=\$v"
v=$(echo "$arg" | cut -d = -f 2-)
lval="${arrname}['${cmdarghashkeythingy31337}']"
eval "$lval=\"$v\""
;; ;;
*) *)
echo "Unable to return string description for ${key}; unknown type ${CMDARG_TYPES[$key]}" >&2 echo "Unable to return string description for ${key}; unknown type ${CMDARG_TYPES[$key]}" >&2