#!/bin/sh

# #NAME# - #DESCRIPTION#

# @configure_input@

# this is usually a good idea
set -e


# Parse the options

TEMP=`getopt -n #NAME# -o \
@output@
o:\
@@
@interactive@
i\
@@
@quiet@
q\
@@
hV \
--long \
@output@
output:,\
@@
@interactive@
interactive,\
@@
@dry-run@
dry-run,\
@@
@no-warn@
no-warn,\
@@
@quiet@
quiet,silent,\
@@
@brief@
brief,\
@@
@verbose@
verbose,\
@@
@directory@
directory:,\
@@
@cd@
cd:,\
@@
help,version -- "$@"`

if [ $? != 0 ] ; then echo "Terminating..." >&2 ; exit 1 ; fi

# Note the quotes around `$TEMP': they are essential!
eval set -- "$TEMP"

while true ; do
    case "$1" in
@output@
	-o|--output) OFILE="$2"; shift 2 ;;
@@
@interactive@
	-i|--interactive) INTERACTIVE="yes"; shift ;;
@@
@dry-run@
	--dry-run) DRY_RUN="yes"; shift ;;
@@
@no-warn@
	--no-warn) NO_WARN="yes"; shift ;;
@@
@quiet@
	-q|--quiet|--silent) QUIET="yes"; shift ;;
@@
@brief@
	--brief) BRIEF="yes"; shift ;;
@@
@verbose@
	--verbose) VERBOSE="yes"; shift ;;
@@
@directory@
	--directory) DIRECTORY="$2"; shift 2 ;;
@@
@cd@
	--cd) NEW_DIRECTORY="$2"; shift 2 ;;
@@
	-V|--version) echo "#NAME# @VERSION@"; exit 0 ;;
	-h|--help)
	    echo "#NAME# - #DESCRIPTION#";
	    echo "usage: #NAME# [options]";
	    echo "options:";
@output@
	    echo "  -o, --output NAME          send output to NAME instead of standard output";
@@
@interactive@
	    echo "  -i, --interactive          prompt for confirmation";
@@
@dry-run@
	    echo "  --dry-run                  take no real actions";
@@
@no-warn@
	    echo "  --no-warn                  disable warnings";
@@
@quiet@
	    echo "  -q, --quiet, --silent      inhibit usual output";
@@
@brief@
	    echo "  --brief                    shorten output";
@@
@verbose@
	    echo "  --verbose                  print more information";
@@
@directory@
	    echo "  --directory NAME           use specified directory ";
@@
@cd@
	    echo "  --cd NAME                  change to specified directory before proceeding";
@@
	    echo "  -h, --help                 display this help and exit";
	    echo "  -V, --version              output version information and exit";

	    exit 0
	    ;;
	--) shift ; break ;;
	*) echo "Internal error!  no case for option \"$1\"" ; exit 1 ;;
    esac
done

# do the work

exit 0
