call usage() with expected parameter list (#782)

pull/785/head
Bryan Howard 2 years ago committed by GitHub
parent ba1dc04f3d
commit 898d9ae53c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -26,9 +26,12 @@ function _check_setup {
}
function _incorrect_usage {
echo "git-secret: abort: $1"
usage
exit "$2"
local message="$1"
local exitcode="$2"
shift 2
echo "git-secret: abort: ${message}"
usage "$@"
exit "${exitcode}"
}
function _show_version {
@ -39,7 +42,7 @@ function _show_version {
function _init_script {
if [[ $# == 0 ]]; then
_incorrect_usage 'no input parameters provided.' 126
_incorrect_usage 'no input parameters provided.' 126 "$@"
fi
# Parse plugin-level options:
@ -71,7 +74,7 @@ function _init_script {
if [[ "$function_exists" == 0 ]] && [[ ! $1 == _* ]]; then
$1 "${@:2}"
else # TODO: elif [[ $(_plugin_exists $1) == 0 ]]; then
_incorrect_usage "command $1 not found." 126
_incorrect_usage "command $1 not found." 126 "$@"
fi
fi
}

Loading…
Cancel
Save