From: freku045@student.liu.se Date: Sat, 10 Dec 2005 19:37:57 GMT Subject: [PATCH 4/25] git-cherry: Print the usage message if we get an unknown option. Message-ID: <11342434771080-git-send-email-freku045@student.liu.se> In-Reply-To: <1134243476675-git-send-email-freku045@student.liu.se> Signed-off-by: Fredrik Kuivinen --- 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] [] +usage () { + die "usage: $0 "'[-v] [] __*__*__*__*__> / @@ -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