mirror of https://github.com/dyne/zuper.git
fix to return codes of option.parse failures
This commit is contained in:
parent
d49b98885d
commit
7e70209e21
13
zuper
13
zuper
|
|
@ -936,8 +936,8 @@ option.parse() {
|
||||||
fi
|
fi
|
||||||
unset discardme
|
unset discardme
|
||||||
if ! zparseopts -M -E -D -Adiscardme ${every_opts}; then
|
if ! zparseopts -M -E -D -Adiscardme ${every_opts}; then
|
||||||
_failure "Error parsing."
|
_failure "Command parses error."
|
||||||
return 127
|
return 1
|
||||||
fi
|
fi
|
||||||
unset discardme
|
unset discardme
|
||||||
subcommand=${1}
|
subcommand=${1}
|
||||||
|
|
@ -947,7 +947,8 @@ option.parse() {
|
||||||
|
|
||||||
if [[ -z ${(k)option_subcommands[$subcommand]} ]]; then
|
if [[ -z ${(k)option_subcommands[$subcommand]} ]]; then
|
||||||
_warning "There's no such command \"::1 subcommand::\"." $subcommand
|
_warning "There's no such command \"::1 subcommand::\"." $subcommand
|
||||||
exitv=127 _failure "Please try -h for help."
|
_failure "Please try -h for help."
|
||||||
|
return 1
|
||||||
fi
|
fi
|
||||||
argv=("${(@)oldstar}")
|
argv=("${(@)oldstar}")
|
||||||
unset oldstar
|
unset oldstar
|
||||||
|
|
@ -960,7 +961,8 @@ option.parse() {
|
||||||
zparseopts -M -E -D -Aoption ${cmd_opts}
|
zparseopts -M -E -D -Aoption ${cmd_opts}
|
||||||
if [[ $? != 0 ]]; then
|
if [[ $? != 0 ]]; then
|
||||||
_warning "Some error occurred during option processing."
|
_warning "Some error occurred during option processing."
|
||||||
exitv=127 _failure "See \"sdk help\" for more info."
|
_failure "See \"sdk help\" for more info."
|
||||||
|
return 1
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
#build option_params (array of arguments) and check if there are unrecognized options
|
#build option_params (array of arguments) and check if there are unrecognized options
|
||||||
|
|
@ -972,7 +974,8 @@ option.parse() {
|
||||||
continue #it shouldn't be appended to option_params
|
continue #it shouldn't be appended to option_params
|
||||||
elif [[ $arg[1] == '-' ]]; then
|
elif [[ $arg[1] == '-' ]]; then
|
||||||
if [[ $ok == 0 ]]; then
|
if [[ $ok == 0 ]]; then
|
||||||
exitv=127 _failure "Unrecognized option ::1 arg:: for subcommand ::2 subcommand::" $arg $subcommand
|
_failure "Unrecognized option ::1 arg:: for subcommand ::2 subcommand::" $arg $subcommand
|
||||||
|
return 1
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
option_params+=$arg
|
option_params+=$arg
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue