aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTeddy Wing2019-06-10 19:45:39 +0200
committerTeddy Wing2019-06-10 19:45:39 +0200
commite776421211a713d182600076ce0ab6b508f9275c (patch)
treefcd7051df507bc99bc503a112f361bfd76db8c11
parent3f10e26f98abaf1ebf7519427f2dfbb5eb03db15 (diff)
downloadcode-review-e776421211a713d182600076ce0ab6b508f9275c.tar.bz2
code-review: Fix `--help` argument
The `shift` call came before I was checking the first argument `$1` if it was '--help'. This caused the program to print the 'nonexistent command' error message. Move the `shift` call to just before we pass on the rest of the command line arguments.
-rwxr-xr-xcode-review3
1 files changed, 1 insertions, 2 deletions
diff --git a/code-review b/code-review
index fb3ce2d..a97df7a 100755
--- a/code-review
+++ b/code-review
@@ -45,8 +45,6 @@ function program_exists () {
program="code-review"
subcommand="$1"
-shift
-
if [ -z "$subcommand" ] || [ "$1" = '--help' ] || [ "$1" = '-h' ]; then
print_usage
exit "$EX_USAGE"
@@ -57,4 +55,5 @@ if ! program_exists "${program}-${subcommand}"; then
exit "$EX_USAGE"
fi
+shift
eval "${program}-${subcommand}" "$@"