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

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

Loading…
Cancel
Save