aboutsummaryrefslogtreecommitdiff
path: root/doc/cli.sh
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2016-01-11 10:04:02 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2016-01-11 10:04:02 +0200
commitad257079568746d71d913c6fca96852da6fe3bd6 (patch)
treed7a59392a1159c630c4fd0ccad816e9fd3acadf3 /doc/cli.sh
parent302834a875804ff943dfb005682949fd3d404d01 (diff)
Reorganize .cli files, add man/xhtml page generation (via script for now)
Diffstat (limited to 'doc/cli.sh')
-rwxr-xr-xdoc/cli.sh58
1 files changed, 58 insertions, 0 deletions
diff --git a/doc/cli.sh b/doc/cli.sh
new file mode 100755
index 0000000..d022a47
--- /dev/null
+++ b/doc/cli.sh
@@ -0,0 +1,58 @@
+#! /usr/bin/env bash
+
+version="0.2.0"
+date="XX January 2016"
+
+trap 'exit 1' ERR
+set -o errtrace # Trap in functions.
+
+function info () { echo "$*" 1>&2; }
+function error () { info "$*"; exit 1; }
+
+while [ $# -gt 0 ]; do
+ case $1 in
+ --clean)
+ rm -f bpkg*.xhtml bpkg*.1
+ exit 0
+ ;;
+ *)
+ error "unexpected $1"
+ ;;
+ esac
+done
+
+function compile ()
+{
+ local n=$1; shift
+
+ # Use a bash array to handle empty arguments.
+ #
+ local o=()
+ while [ $# -gt 0 ]; do
+ o=("${o[@]}" "$1")
+ shift
+ done
+
+ cli -I .. -v version="$version" -v date="$date" --include-base-last "${o[@]}" \
+--generate-html --html-prologue-file prologue.xhtml --html-epilogue-file \
+epilogue.xhtml --html-suffix .xhtml ../bpkg/$n.cli
+
+ cli -I .. -v version="$version" -v date="$date" --include-base-last "${o[@]}" \
+--generate-man --man-prologue-file prologue.1 --man-epilogue-file epilogue.1 \
+--man-suffix .1 ../bpkg/$n.cli
+}
+
+o="--output-prefix bpkg- --class-doc bpkg::common_options=short"
+
+# A few special cases.
+#
+compile "common" $o --output-suffix "-options" --class-doc bpkg::common_options=long
+compile "bpkg" $o --output-prefix "" --suppress-undocumented --class-doc bpkg::commands=short --class-doc bpkg::topics=short
+
+pages="cfg-add cfg-create cfg-fetch help pkg-build pkg-clean pkg-configure \
+pkg-disfigure pkg-drop pkg-fetch pkg-install pkg-purge pkg-status \
+pkg-uninstall pkg-unpack pkg-update pkg-verify rep-create rep-info"
+
+for p in $pages; do
+ compile $p $o
+done