Fixed the exporting of cmdarg_ and CMDARG_ variables for subshells (for real this time)
This commit is contained in:
12
cmdarg.sh
12
cmdarg.sh
@@ -324,12 +324,18 @@ function cmdarg_purge
|
|||||||
arrays="$arrays CMDARG_FLAGS CMDARG_TYPES"
|
arrays="$arrays CMDARG_FLAGS CMDARG_TYPES"
|
||||||
for arr in $arrays
|
for arr in $arrays
|
||||||
do
|
do
|
||||||
unset $arr
|
str='${!'"$arr"'[@]}'
|
||||||
unset $arr[*]
|
for key in $(eval "echo $str")
|
||||||
|
do
|
||||||
|
str="$arr[$key]"
|
||||||
|
eval "unset $str"
|
||||||
|
done
|
||||||
done
|
done
|
||||||
CMDARG_GETOPTLIST="h"
|
CMDARG_GETOPTLIST="h"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if [[ "${_DEFINED_CMDARG}" == "" ]]; then
|
||||||
|
export _DEFINED_CMDARG=0
|
||||||
# Holds the final map of configuration options
|
# Holds the final map of configuration options
|
||||||
declare -A cmdarg_cfg
|
declare -A cmdarg_cfg
|
||||||
# Maps (short arg) -> (long arg)
|
# Maps (short arg) -> (long arg)
|
||||||
@@ -352,7 +358,5 @@ declare -A CMDARG_INFO
|
|||||||
declare -A CMDARG_FLAGS
|
declare -A CMDARG_FLAGS
|
||||||
# Map of (short arg) -> type (string, array, hash)
|
# Map of (short arg) -> type (string, array, hash)
|
||||||
declare -A CMDARG_TYPES
|
declare -A CMDARG_TYPES
|
||||||
|
|
||||||
if [[ "${CMDARG_GETOPTLIST}" == "" ]]; then
|
|
||||||
CMDARG_GETOPTLIST="h"
|
CMDARG_GETOPTLIST="h"
|
||||||
fi
|
fi
|
||||||
|
|||||||
Reference in New Issue
Block a user