]> arthur.barton.de Git - ax-make.git/commitdiff
axify: Add usage information, better parse command line
authorAlexander Barton <alex@barton.de>
Sat, 20 Dec 2014 14:57:00 +0000 (15:57 +0100)
committerAlexander Barton <alex@barton.de>
Sat, 20 Dec 2014 14:57:02 +0000 (15:57 +0100)
scripts/axify

index 9f82f16f00efc8ab8875a5b47cc7a601d89e6b3b..56dd9d71514b6e9703f29dc50f56c8024a3e1dd5 100755 (executable)
 
 NAME=`basename "$0"`
 
 
 NAME=`basename "$0"`
 
+Usage() {
+       echo "Usage: $NAME [<lib-dir>]"
+       echo
+       echo "  <lib-dir>    Library directory. Default: current working directory."
+       echo
+       exit 2
+}
+
+while true; do
+       case "$1" in
+               "-"*)
+                       Usage
+                       ;;
+               *)
+                       break
+                       ;;
+       esac
+       shift
+done
+
+[ $# -gt 1 ] && Usage
+
 [ -n "$1" ] && LIB_D="$1" || LIB_D="."
 
 if [ -r "/usr/local/share/ax-make/Makefile.ax" ]; then
 [ -n "$1" ] && LIB_D="$1" || LIB_D="."
 
 if [ -r "/usr/local/share/ax-make/Makefile.ax" ]; then