summaryrefslogtreecommitdiff
path: root/.config/nvim/templates/sh/getopts.sh
diff options
context:
space:
mode:
Diffstat (limited to '.config/nvim/templates/sh/getopts.sh')
-rw-r--r--.config/nvim/templates/sh/getopts.sh6
1 files changed, 6 insertions, 0 deletions
diff --git a/.config/nvim/templates/sh/getopts.sh b/.config/nvim/templates/sh/getopts.sh
new file mode 100644
index 0000000..9013ff9
--- /dev/null
+++ b/.config/nvim/templates/sh/getopts.sh
@@ -0,0 +1,6 @@
+while getopts 'h' o; do case "$o" in
+ h) help >&2; exit ;;
+ *) err "invalid option -- '$OPTARG'" ;;
+esac done
+shift $((OPTIND - 1))
+