aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPatrick Spek <p.spek@tyil.nl>2020-02-20 22:44:00 +0100
committerPatrick Spek <p.spek@tyil.nl>2020-02-20 22:44:00 +0100
commit99a1b0b0d9372a41337361679d1fbb6aa0b1829b (patch)
treedaf543c110bb5d629692a14ecba8a0864f2f7b53
parenta7dc45724e0ef950b14700509b6b34ac18e93668 (diff)
Update sh template
-rw-r--r--.local/templates/sh20
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()