[PATCH 4/25] git-cherry: Print the usage message if we get an unknown option.
Signed-off-by: Fredrik Kuivinen <freku045@student.liu.se>
---
git-cherry.sh | 18 +++++++++++++++---
1 files changed, 15 insertions(+), 3 deletions(-)
10b829123619b4b3c398398726c830db87f7525a
diff --git a/git-cherry.sh b/git-cherry.sh
index 867522b..c21cf65 100755
--- a/git-cherry.sh
+++ b/git-cherry.sh
@@ -5,7 +5,8 @@
. git-sh-setup
-usage="usage: $0 "'[-v] <upstream> [<head>]
+usage () {
+ die "usage: $0 "'[-v] <upstream> [<head>]
__*__*__*__*__> <upstream>
/
@@ -18,8 +19,19 @@ compared against the change each commit
it is shown on the standard output with prefix "+". Otherwise
it is shown with prefix "-".
'
+}
-case "$1" in -v) verbose=t; shift ;; esac
+while [ "$#" != "0" ]; do
+ case "$1" in
+ "-v")
+ verbose=t;
+ shift
+ ;;
+ -*)
+ usage
+ ;;
+ esac
+done
case "$#,$1" in
1,*..*)
@@ -35,7 +47,7 @@ case "$#" in
2) upstream=`git-rev-parse --verify "$1"` &&
ours=`git-rev-parse --verify "$2"` || exit
;;
-*) echo >&2 "$usage"; exit 1 ;;
+*) usage ;;
esac
# Note that these list commits in reverse order;
--
0.99.9.GIT