aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Ferrell <major@homeonderanged.org>2014-02-28 06:57:02 -0800
committerMark Ferrell <major@homeonderanged.org>2014-02-28 06:57:02 -0800
commit00a575bd57732592c47413a55282c27ddd30076d (patch)
tree1979d86abf8f87ce02ae982ee5df95f617bbf16d
parent49484ee1f09ca663dc4adf47ee084cd087840be5 (diff)
Rework the help system
* Added a build-help sub-command. Trying to improve the quality of the help environment so that each command can properly supply its own documentation.
-rwxr-xr-xbuild70
-rw-r--r--builder/build-help61
2 files changed, 64 insertions, 67 deletions
diff --git a/build b/build
index cd5b932..26724cf 100755
--- a/build
+++ b/build
@@ -1,65 +1,6 @@
#!/bin/sh
set -e
-## usage
-# Simply display the builder usage. Though it would be nice if some of this
-# information was pushed down into the sub-commands.
-usage()
-{
-cat<<EOF
-usage: ${0##*/} [options] <command> [command-opts] [all|<category>/<package|all> ...]
-
-Options
--------
- -v, --version Display the builder version.
- -d, --debug Enable debug logging.
- -h, --help Display the builder help and exit (may appear anywhere on the
- command line).
-
-Commands
---------
- query The query is used internally by builder, while allowing
- one to query various packages from the builder repository.
-
- options
- -------
-
- -b, --build-deps
- -d, --depends
- -n, --name
- -d, --description
- -v, --version
- -u, --source-uri
- -s, --summary
-
- source Create a copy/checkout of the package sources inside of
- packages/<category>/<name>/source. The source/ directory
- within a package takes precendences over the SOURCE_URI,
- allowing in-place development of various packages. This is
- particularly useful if the SOURCE_URI is an SCM.
-
- fetch Fetch the sources for a package from the SOURCE_URI and store
- them into the sources/ top-level directory. This is done
- automatically for all commands which depend on it.
-
- package Prep, compile and construct a binary "artifact" file for a
- given package. This command is performed automatically for all
- commands which depend on it.
-
- install Install a binary artifact into the sysroot. This action is
- performed automatically for any packages which the current
- target depends on. If necessary produce binary artifacts for
- all package deps.
-
- clean Clean specified package from sysroot and artifacts.
-
- distclean Clean up specified package from sysroot, artifacts, and sources.
-
- export Export the binary package to an rpm.
-
-EOF
-}
-
## mkenv
# prepare the environment structure for the current package
mkenv()
@@ -170,13 +111,6 @@ if [ -f "${1}" ]; then
esac
fi
-for arg in "$@"; do
- case "${arg}" in
- (-h|-help|--help) usage; exit 0;;
- esac
-done
-unset arg
-
DEBUG="0"
while [ "$#" -gt "0" ]; do
case "$1" in
@@ -195,6 +129,8 @@ while [ "$#" -gt "0" ]; do
export BUILDER_DEBUG
set -x
;;
+ (-h|-help|--help)
+ set -- help;;
(-*) echo "error: unknown option '${1}'" >&2
echo "try '${0} --help'" >&2
exit 1
@@ -302,7 +238,7 @@ fi
# FIXME Support custom commands somehow..
if [ ! -x "${BUILDER_LIBDIR}/build-${ACTION}" ]; then
error "unknown action '${ACTION}'"
- echo "try '${0} --help'" >&2
+ echo "try '${0} help'" >&2
exit 1
fi
diff --git a/builder/build-help b/builder/build-help
new file mode 100644
index 0000000..7405818
--- /dev/null
+++ b/builder/build-help
@@ -0,0 +1,61 @@
+#!/usr/bin/env build
+
+while test "$#" -gt '0'; do
+ case "${1}" in
+ (--) shift; break;;
+ (-*) die "unknown option '${1}'";;
+ (*) exec build "${1}" --help;;
+ esac
+done
+
+## usage
+# Simply display the builder usage. Though it would be nice if some of this
+# information was pushed down into the sub-commands.
+usage()
+{
+cat<<EOF
+usage: ${0##*/} [options] <command> [command-opts] [all|<category>/<package|all> ...]
+
+Options
+-------
+ -v, --version Display the builder version.
+ -d, --debug Enable debug logging.
+ -h, --help Display the builder help and exit (may appear anywhere on the
+ command line).
+
+Commands
+--------
+ query The query is used internally by builder, while allowing
+ one to query various packages from the builder repository.
+
+ source Create a copy/checkout of the package sources inside of
+ packages/<category>/<name>/source. The source/ directory
+ within a package takes precendences over the SOURCE_URI,
+ allowing in-place development of various packages. This is
+ particularly useful if the SOURCE_URI is an SCM.
+
+ fetch Fetch the sources for a package from the SOURCE_URI and store
+ them into the sources/ top-level directory. This is done
+ automatically for all commands which depend on it.
+
+ package Prep, compile and construct a binary "artifact" file for a
+ given package. This command is performed automatically for all
+ commands which depend on it.
+
+ install Install a binary artifact into the sysroot. This action is
+ performed automatically for any packages which the current
+ target depends on. If necessary produce binary artifacts for
+ all package deps.
+
+ clean Clean specified package from sysroot and artifacts.
+
+ distclean Clean up specified package from sysroot, artifacts, and sources.
+
+ export Export the binary package to an rpm.
+
+EOF
+}
+
+
+
+# vim: filetype=sh