changeset 2488:d9f6c4ade221

Patch tool: replace elifs with case. Also handles errors.
author Ryan Pavlik <rpavlik@iastate.edu>
date Mon, 07 May 2012 12:40:30 -0500
parents c7e932c8046d
children 2f3353b7a313
files tools/patch-tool-mxe
diffstat 1 files changed, 23 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/tools/patch-tool-mxe	Wed Apr 25 19:25:45 2012 -0500
+++ b/tools/patch-tool-mxe	Mon May 07 12:40:30 2012 -0500
@@ -73,10 +73,26 @@
   git am --keep-cr
 }
 
-if [ "$cmd" == "init" ]; then
-  init_git $pkg
-elif [ "$cmd" == "import" ]; then
-  import_patch $pkg
-elif [ "$cmd" == "export" ]; then
-  export_patch $pkg
-fi
+case "$cmd" in
+  init)
+    init_git $pkg
+    ;;
+  import)
+    import_patch $pkg
+    ;;
+  export)
+    export_patch $pkg
+    ;;
+  *)
+    echo "Unrecognized command '${cmd}'" >&2
+    cat <<EOS
+    Usage: $0 COMMAND PACKAGENAME
+    where COMMAND is one of:
+      init - create a git directory for the package with the raw source
+      import - apply the "pkgname-1-fixes.patch" patch commits
+      export - create/replace the "pkgname-1-fixes.patch" patch with a patch of all commits since init.
+EOS
+    exit 1
+    ;;
+esac
+