diff options
Diffstat (limited to '.config/nvim/templates/sh')
-rw-r--r-- | .config/nvim/templates/sh/err.sh | 2 | ||||
-rw-r--r-- | .config/nvim/templates/sh/getopts.sh | 6 | ||||
-rw-r--r-- | .config/nvim/templates/sh/help.sh | 10 |
3 files changed, 18 insertions, 0 deletions
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 + |