Fixed a bug where the #include fakery caused chained scripts that wanted to call cmdarg were unable to do so and were unable to see CMDARG_ associative arrays, so wierd things started happening

This commit is contained in:
2013-10-29 19:10:08 -04:00
parent 51b3114748
commit 5facea1cc5

View File

@@ -322,20 +322,11 @@ function cmdarg_purge
arrays="cmdarg_cfg CMDARG CMDARG_REV CMDARG_OPTIONAL CMDARG_REQUIRED"
arrays="$arrays CMDARG_DESC CMDARG_DEFAULT CMDARG_VALIDATORS CMDARG_INFO"
arrays="$arrays CMDARG_FLAGS CMDARG_TYPES"
for arr in $arrays
do
str='${!'"$arr"'[@]}'
for key in $(eval "echo $str")
do
str="$arr[$key]"
eval "unset $str"
done
done
unset $arr
unset $arr[*]
CMDARG_GETOPTLIST="h"
}
if [[ "${_DEFINED_CMDARG}" == "" ]]; then
export _DEFINED_CMDARG=0
# Holds the final map of configuration options
declare -A cmdarg_cfg
# Maps (short arg) -> (long arg)
@@ -358,5 +349,7 @@ if [[ "${_DEFINED_CMDARG}" == "" ]]; then
declare -A CMDARG_FLAGS
# Map of (short arg) -> type (string, array, hash)
declare -A CMDARG_TYPES
if [[ "${CMDARG_GETOPTLIST}" == "" ]]; then
CMDARG_GETOPTLIST="h"
fi