From 4272f47b043f7b460066cc2198eba6f75227e43c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= Date: Mon, 12 Jul 2010 10:32:18 +0200 Subject: [PATCH] Support --help, --version and --changelog. --- sunrise-commit | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/sunrise-commit b/sunrise-commit index 8dc303b..1396f94 100755 --- a/sunrise-commit +++ b/sunrise-commit @@ -102,6 +102,20 @@ vcs_status() { fi } +print_help() { + cat <<_EOH_ +Synopsis: + sunrise-commit [options] [--] + +Options: + -?, -h, --help print this message, + -V, --version print version string, + + -c, --changelog backwards compat (ignored), + -v, --verbose enable verbose output. +_EOH_ +} + # Guess what! main() { local commitmsg @@ -109,9 +123,22 @@ main() { while [ ${#} -gt 0 ]; do case "${1}" in + --help|-?|-h) + print_help + exit 0 + ;; + --version|-V) + echo 'sunrise-commit 1.0' + exit 0 + ;; + + -c|--changelog) + # Now changelog entries are implicit -- backwards compat. + ;; -v|--verbose) SC_VERBOSE=1 ;; + --) shift commitmsg="${commitmsg+${commitmsg} }${@}"