summaryrefslogtreecommitdiff
path: root/new-doc
diff options
context:
space:
mode:
authordakkar <dakkar@thenautilus.net>2012-09-23 18:56:07 +0100
committerdakkar <dakkar@thenautilus.net>2012-09-23 20:37:21 +0100
commit9c9a41ce0d3773040d4b9a62c4c99c62196c418d (patch)
treec3e3ab1d1ef1ae9c3d1fd66e8ae5bcb9e39573a3 /new-doc
parentanime bump (diff)
downloadthenautilus-9c9a41ce0d3773040d4b9a62c4c99c62196c418d.tar.gz
thenautilus-9c9a41ce0d3773040d4b9a62c4c99c62196c418d.tar.bz2
thenautilus-9c9a41ce0d3773040d4b9a62c4c99c62196c418d.zip
infrastructure for reviews
Diffstat (limited to 'new-doc')
-rwxr-xr-xnew-doc27
1 files changed, 17 insertions, 10 deletions
diff --git a/new-doc b/new-doc
index 9c0f0c4..d99c79d 100755
--- a/new-doc
+++ b/new-doc
@@ -2,9 +2,7 @@
here="$(cd "$(dirname "$0")";pwd)";
cd "$(dirname "$0")"/src
-if [[ $# -eq 0 ]]; then
- cat <<EOF
-new-doc - create new documents for WebCoso
+usage="new-doc - create new documents for WebCoso
Usage:
@@ -14,8 +12,11 @@ The <document path> will be taken relative to
$(pwd)
Non-existent tags will be created
-EOF
-exit 1
+"
+
+if [[ $# -eq 0 ]]; then
+ >&2 echo "$usage"
+ exit 1
fi
shopt -s extglob
@@ -23,10 +24,16 @@ shopt -s extglob
now="$(TZ=UTC date +'%F %T')"
force=0
-if [[ "$1" == "-f" ]]; then
- force=1
- shift
-fi
+kind=''
+while getopts fk: optname; do
+ case "$optname" in
+ f) force=1 ;;
+ k) kind="$OPTARG" ;;
+ ?) echo "$usage"; exit 2 ;;
+ esac
+done
+shift $[ $OPTIND - 1 ]
+
docname="$1"
shift
declare -a tags
@@ -71,7 +78,7 @@ EOF
echo "/document.${lang}.du.xml" >> "${docname}/.gitignore"
done
-ln -s "${docname//+([^\/])/..}"/../templates/du2html.xsl "$docname"/
+ln -s "${docname//+([^\/])/..}"/../templates/du2html${kind:+"-$kind"}.xsl "$docname"/du2html.xsl
cd "$here"
./new-tag "${tags[@]}"