wcarhart / koi

Bashful argument parsing

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Registered positionalarray with empty arguments results in nonempty array

wcarhart opened this issue · comments

If I add an an optional positionalarray argument to a function and then don't include any arguments when calling it, I still get an non empty array.

function myfunction {
  __addarg "-h" "--help" "help" "optional" "" "help text"
  __addarg "" "arg" "positionalarray" "optional" "" "help text"
  __parseargs "$@"
  if [[ "${#arg[@]}" -ne 0 ]] ; then echo notempty ; fi
}
$ ./myscript myfunction
notempty