Check for correct number of arguments.

Otherwise, print some usage info.
This commit is contained in:
Ryan Jacobs 2016-02-07 14:06:55 -08:00
parent 28c8270318
commit 7dc4d5a45f
No known key found for this signature in database
GPG key ID: 9334C38DCEED707A

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.";