Because the bit pattern __opt_flag_is_array has more than one set
bit, it is not enough to use a bitwise and to check if an option is
an array, but that is what `opt_print_help()' does.
This commit modifies `opt_print_help()' so that it checks whether
the result of the bitwise and equals __opt_flag_is_array, avoiding
any option with a value to be treated as an array.
for short in $(array_sort "${__opt_short[@]}"); do
local long
+ local -i flags
long="${__opt_map[-$short]}"
+ flags="${__opt_flags[$long]}"
printf "\t-%s\t--%s\t%s\n" \
"$short" "$long" "${__opt_desc[$long]}"
- if (( ${__opt_flags["$long"]} & __opt_flag_has_value )) &&
+ if (( flags & __opt_flag_has_value )) &&
array_contains "$long" "${!__opt_default[@]}"; then
- if (( ${__opt_flags["$long"]} & __opt_flag_is_array )); then
+ if (( ( flags & __opt_flag_is_array ) == __opt_flag_is_array )); then
local -n __opt_print_help_array="${__opt_default[$long]}"
if (( ${#__opt_print_help_array[@]} > 0 )); then