diff options
-rw-r--r-- | .local/templates/sh | 20 |
1 files changed, 4 insertions, 16 deletions
diff --git a/.local/templates/sh b/.local/templates/sh index 064986c..11af633 100644 --- a/.local/templates/sh +++ b/.local/templates/sh @@ -13,31 +13,19 @@ main() { # Handle opts - opts "$@" - shift "$OPTS" - unset OPTS - - # Show help - [ "$OPT_HELP_ONLY" ] && usage && exit 0 - - # TODO: Write actual program -} - -opts() -{ - OPTS=0 - while getopts ":h" opt do case "$opt" in - h) OPT_HELP_ONLY=1 ;; + h) usage && exit 0 ;; *) printf "Invalid option passed: %s\n" "$OPTARG" >&2 ;; esac done - unset opt + shift $(( OPTIND - 1 )) + + # TODO: Write actual program } usage() |