]> gitweb @ CieloNegro.org - autobuild.git/commitdiff
src/main.bash: better help message
authorPHO <pho@cielonegro.org>
Wed, 4 Jul 2012 08:04:21 +0000 (17:04 +0900)
committerPHO <pho@cielonegro.org>
Wed, 4 Jul 2012 08:04:21 +0000 (17:04 +0900)
src/main.bash

index 6c0b3c491e1087f2dd85983eb615eb1fb5e0ffa6..b59aa3c0d021e2b1d06ab5ccc1b855a196aab194 100644 (file)
@@ -46,21 +46,44 @@ function dist () {
 
 function install () {
     build
 
 function install () {
     build
-    runMake -C "_build" install
+    runMake -C "_build" install "$0"
+}
+
+function usage () {
+    cat <<EOF >&2
+Usage: $0 [COMMAND]
+
+This is an automation script designed to work with autotools. It creates a
+directory "./_build" and builds any files inside it.
+
+If no COMMAND is given, it defaults to "build".
+
+Commands:
+    build          run "$0 configure" then make(1).
+    check [ARG]    run "$0 build" then "make check [ARG]".
+    configure      run autoreconf(1) and "./configure" if necessary.
+    clean          run "rm -rf _build"
+    dist           run "make dist"
+    doc            similar to "$0 build" but only build the documentation.
+    install [ARG]  run "$0 build" then "make install [ARG]".
+
+Please report any bugs, feature requests, and pull requests (the most
+preferred!) to the maintainer presented in the preamble of the "$0" itself.
+EOF
+    return 1
 }
 
 function main () {
     local cmd
     case "$1" in
 }
 
 function main () {
     local cmd
     case "$1" in
-        ""|"build") cmd=build  ;;
-        "doc"     ) cmd=doc    ;;
-        "check"   ) cmd=check  ;;
-        "clean"   ) cmd=clean  ;;
-        "dist"    ) cmd=dist   ;;
-        "install" ) cmd=install;;
-        *)
-            echo "Usage: $0 [build | doc | check | clean | dist | install]" >&2
-            exit 1
+        ""|"build" ) cmd="build"    ;;
+        "configure") cmd="configure";;
+        "doc"      ) cmd="doc"      ;;
+        "check"    ) cmd="check"    ;;
+        "clean"    ) cmd="clean"    ;;
+        "dist"     ) cmd="dist"     ;;
+        "install"  ) cmd="install"  ;;
+        *)           cmd="usage"    ;;
     esac
     if (( $# > 0 )); then
         shift
     esac
     if (( $# > 0 )); then
         shift