mirror of
https://github.com/jayphelps/git-blame-someone-else.git
synced 2025-06-16 09:01:38 +02:00
Check for correct number of arguments.
Otherwise, print some usage info.
This commit is contained in:
parent
7d25a9fc30
commit
c1a691d965
1 changed files with 6 additions and 1 deletions
|
@ -1,5 +1,10 @@
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
if [ $# -ne 2 ]; then
|
||||||
|
>&2 echo "Usage: $0 <author> <commit>"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
AUTHOR=$1
|
AUTHOR=$1
|
||||||
AUTHOR_NAME=$(echo $AUTHOR | perl -wlne '/^(.*)\s*<.*>$/ and print $1')
|
AUTHOR_NAME=$(echo $AUTHOR | perl -wlne '/^(.*)\s*<.*>$/ and print $1')
|
||||||
AUTHOR_EMAIL=$(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
|
git rebase --continue
|
||||||
} &> /dev/null
|
} &> /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.";
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue