summaryrefslogtreecommitdiff
path: root/.config/nvim/templates
diff options
context:
space:
mode:
Diffstat (limited to '.config/nvim/templates')
-rw-r--r--.config/nvim/templates/_default.sh2
-rw-r--r--.config/nvim/templates/sh/err.sh2
-rw-r--r--.config/nvim/templates/sh/getopts.sh6
-rw-r--r--.config/nvim/templates/sh/help.sh10
4 files changed, 20 insertions, 0 deletions
diff --git a/.config/nvim/templates/_default.sh b/.config/nvim/templates/_default.sh
new file mode 100644
index 0000000..13f4793
--- /dev/null
+++ b/.config/nvim/templates/_default.sh
@@ -0,0 +1,2 @@
+#!/bin/sh
+
diff --git a/.config/nvim/templates/sh/err.sh b/.config/nvim/templates/sh/err.sh
new file mode 100644
index 0000000..a4414cd
--- /dev/null
+++ b/.config/nvim/templates/sh/err.sh
@@ -0,0 +1,2 @@
+err() { printf '%s: %s\n' "$0" "$@" >&2; exit 1; }
+
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))
+
diff --git a/.config/nvim/templates/sh/help.sh b/.config/nvim/templates/sh/help.sh
new file mode 100644
index 0000000..953de68
--- /dev/null
+++ b/.config/nvim/templates/sh/help.sh
@@ -0,0 +1,10 @@
+help() { echo "<++> -
+
+USAGE:
+ <++> [OPTION]...
+
+OPTIONS:
+ -h show this help message"; }
+
+[ "$#" -lt 1 ] && help >&2 && exit 1
+