chiark / gitweb /
tg import: Standard options parsing
[topgit.git] / tg-import.sh
index 6c991c5e8840b160d457168bf393cea7d5a9cac8..910d30080abb498c89d216280104622a6c07700d 100644 (file)
@@ -1,7 +1,25 @@
 #!/bin/sh
 # TopGit - A different patch queue manager
+# (c) Petr Baudis <pasky@suse.cz>  2008
+# (c) Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>  2008
 # GPLv2
 
+ranges=
+
+
+## Parse options
+
+while [ -n "$1" ]; do
+       arg="$1"; shift
+       case "$arg" in
+       -*)
+               echo "Usage: tg [...] import RANGE..." >&2
+               exit 1;;
+       *)
+               ranges="$ranges $arg";;
+       esac
+done
+
 
 tg_get_commit_msg()
 {
@@ -38,7 +56,7 @@ tg_process_commit()
 }
 
 # nice arg verification stolen from git-format-patch.sh
-for revpair
+for revpair in $ranges
 do
        case "$revpair" in
        ?*..?*)