diff options
author | Patrick Spek <p.spek@tyil.nl> | 2019-10-29 13:03:40 +0100 |
---|---|---|
committer | Patrick Spek <p.spek@tyil.nl> | 2019-10-29 13:03:40 +0100 |
commit | c48413489b828a566c2fb0a1872ed2a59284f310 (patch) | |
tree | 35b3ab8a098ec2098df7782611b6fd357ff8ec4f /.local/templates/sh | |
parent | c70f15bca0f429d339aecff7c0f6a78c66688647 (diff) | |
parent | f5d1351d341370f38f130eb994df5b2131a20002 (diff) |
Merge branch 'master' of gitlab.com:tyil/dotfiles
Diffstat (limited to '.local/templates/sh')
-rw-r--r-- | .local/templates/sh | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/.local/templates/sh b/.local/templates/sh new file mode 100644 index 0000000..27cae4a --- /dev/null +++ b/.local/templates/sh @@ -0,0 +1,46 @@ +#! /usr/bin/env sh + +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 ;; + *) + printf "Invalid option passed: %s\n" "$OPTARG" >&2 + ;; + esac + done + + unset opt +} + +usage() +{ + cat <<EOF +Usage: + $(basename "$0") -h + +Nondescript + +Options: + -h Show this help text and exit. +EOF +} + +main "$@" |