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