#!/bin/bash # $HeadURL$ $LastChangedRevision$ # Modules . $(miniade) || { echo "${0##*/}: ERROR: miniade failed (hint: run 'miniade' to see error)" >&2; exit 1; } # Configurable stuff # Other globals main() { local MY_ARGS #local PROGNAME # Defaults for options QAZ=false WSX=unset # Process options special_opts_handler() { case $1 in --qaz) QAZ=true ;; --wsx) [ "X$2" != X ] || return 1 WSX=$2 extra_shift ;; # can't shift local $* so inform process_special_options() *) return 1 ;; esac } miniade_process_options --help-handler=help --special-opts-handler=special_opts_handler MY_ARGS "$@" && set -- "${MY_ARGS[@]}" # Process arguments [ $# = 0 ] || miniade_bad_usage # Sanity checks and derivations #miniade_get_progname PROGNAME # Guts miniade_info "running ..." miniade_debug 10 'this is a debug message' echo "QAZ=$QAZ" echo "WSX=$WSX" } help() { local PROGNAME miniade_get_progname PROGNAME echo "Usage: $PROGNAME [ ] [ --qaz ] [ --wsx ]" exit 0 } main "$@"