mirror of
https://github.com/neovim/neovim.git
synced 2024-12-19 18:55:14 -07:00
pvscheck: Handle invalid option error gracefully
This commit is contained in:
parent
d72df05b93
commit
7f24736ebc
@ -50,7 +50,17 @@ help() {
|
||||
}
|
||||
|
||||
getopts_error() {
|
||||
printf '%s\n' "$1" >&2
|
||||
local msg="$1" ; shift
|
||||
local do_help=
|
||||
if test "$msg" = "--help" ; then
|
||||
msg="$1" ; shift
|
||||
do_help=1
|
||||
fi
|
||||
printf '%s\n' "$msg" >&2
|
||||
if test -n "$do_help" ; then
|
||||
printf '\n' >&2
|
||||
help >&2
|
||||
fi
|
||||
echo 'return 1'
|
||||
return 1
|
||||
}
|
||||
@ -146,8 +156,8 @@ getopts_long() {
|
||||
if test -n "$opt_base" ; then
|
||||
eval "local occurred_$opt_base=1"
|
||||
|
||||
eval "local act_1=\"\$act_1_$opt_base\""
|
||||
eval "local varname=\"\$varname_$opt_base\""
|
||||
eval "local act_1=\"\${act_1_$opt_base:-}\""
|
||||
eval "local varname=\"\${varname_$opt_base:-}\""
|
||||
local need_val=
|
||||
local func=
|
||||
case "$act_1" in
|
||||
@ -170,6 +180,9 @@ getopts_long() {
|
||||
eval "varname=\"\${act_3_${opt_base}:-$varname}\""
|
||||
need_val=1
|
||||
;;
|
||||
("")
|
||||
getopts_error --help "Wrong argument: $argument"
|
||||
;;
|
||||
esac
|
||||
if test -n "$need_val" ; then
|
||||
local val=
|
||||
|
Loading…
Reference in New Issue
Block a user