You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add unknown_option=() to the parse_param() function.
In the block -?*), replace the existing code with:
-?*)
empty_command=0
exists=0
for i in "${!unknown_option[@]}"
do
if [ "${unknown_option[$i]}" == "${1}" ]
then
exists=1
fi
done
[ "$exists" -eq 0 ] && unknown_option+=("${1}")
;;
Re-order the [[ $empty_command -eq 1 ]] && usage and $unknown_option part to use:
for i in "${!unknown_option[@]}"
do
empty_command=1
msg "[ERROR] ${RED}Unknown option provided: ${unknown_option[$i]}${NOFORMAT}"
done
[[ $empty_command -eq 1 ]] && usage
Note that this doesn't handle something like: some_command --unknown "with value" - you'd need to check whether the $2 contains a non-hyphen prefixed string and if it does, add it on to the unknown_option array member.
The text was updated successfully, but these errors were encountered:
Add
unknown_option=()
to theparse_param()
function.In the block
-?*)
, replace the existing code with:Re-order the
[[ $empty_command -eq 1 ]] && usage
and$unknown_option
part to use:Note that this doesn't handle something like:
some_command --unknown "with value"
- you'd need to check whether the$2
contains a non-hyphen prefixed string and if it does, add it on to theunknown_option
array member.The text was updated successfully, but these errors were encountered: