Check for correct number of arguments.

Otherwise, print some usage info.
This commit is contained in:
Cory Boyd 2016-02-07 14:06:55 -08:00
parent 7d25a9fc30
commit c1a691d965

View file

@ -1,5 +1,10 @@
#!/usr/bin/env bash
if [ $# -ne 2 ]; then
>&2 echo "Usage: $0 <author> <commit>"
exit 1
fi
AUTHOR=$1
AUTHOR_NAME=$(echo $AUTHOR | perl -wlne '/^(.*)\s*<.*>$/ and print $1')
AUTHOR_EMAIL=$(echo $AUTHOR | perl -wlne '/^.*\s*<(.*)>$/ and print $1')
@ -11,4 +16,4 @@ COMMIT=$(git rev-parse --short $2)
git rebase --continue
} &> /dev/null
echo "$AUTHOR_NAME is now the author of $COMMIT. You're officially an asshole.";
echo "$AUTHOR_NAME is now the author of $COMMIT. You're officially an asshole.";