aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSebastien Douheret <sebastien.douheret@iot.bzh>2017-09-21 09:50:05 +0200
committerSebastien Douheret <sebastien.douheret@iot.bzh>2017-09-21 09:50:05 +0200
commit887d9406bbf6aaf239152b74f4963be79699027c (patch)
treefb92cdeedd5c29cd1aaddbfa75fd1612ae267e89
parent4296527c4e54ff638e92e368c5309a327892beee (diff)
Allow to pass additional arguments.
For example: ./gendocs serve --port 4100
-rwxr-xr-xgendocs.sh17
1 files changed, 10 insertions, 7 deletions
diff --git a/gendocs.sh b/gendocs.sh
index 637ef1d..d3ff4f5 100755
--- a/gendocs.sh
+++ b/gendocs.sh
@@ -32,19 +32,22 @@ DEBUG_FLAG=""
DRY=""
DO_ACTION=""
OUT_DIR=./build
+ARGS=""
[[ $? != 0 ]] && usage
while [ $# -gt 0 ]; do
case "$1" in
- --debug) DEBUG_FLAG="--log=debug --debug";;
- -d|--dry) DRY=echo;;
- -h|--help) usage;;
- pdf | serve | doxygen) DO_ACTION=$1;;
- --) break;;
+ --debug) DEBUG_FLAG="--log=debug --debug";;
+ -d|--dry) DRY=echo;;
+ -h|--help) usage;;
+ pdf | serve | doxygen) DO_ACTION=$1;;
+ --) shift; ARGS="$ARGS $*"; break;;
+ *) ARGS="$ARGS $1";;
esac
shift
done
+
cd $(dirname $0)
ROOTDIR=`pwd -P`
@@ -65,10 +68,10 @@ if [ "$DO_ACTION" = "pdf" -o "$DO_ACTION" = "serve" ]; then
VERSION="_v$(grep '"version":' $ROOTDIR/book.json | cut -d'"' -f 4)"
OUTFILE=$OUT_DIR/$OUTFILENAME$VERSION.pdf
- $DRY $GITBOOK pdf $ROOTDIR $OUTFILE $DEBUG_FLAG
+ $DRY $GITBOOK pdf $ROOTDIR $OUTFILE $DEBUG_FLAG $ARGS
[ "$?" = "0" ] && echo "PDF has been successfully generated in $OUTFILE"
else
- $DRY $GITBOOK serve $DEBUG_FLAG
+ $DRY $GITBOOK serve $DEBUG_FLAG $ARGS
fi
elif [ "$DO_ACTION" = "doxygen" ]; then