diff options
| author | Anton Bobov <anton@bobov.name> | 2025-02-26 23:58:29 +0500 |
|---|---|---|
| committer | Anton Bobov <anton@bobov.name> | 2025-02-26 23:58:29 +0500 |
| commit | 8a8ac9b7cafd926aa8196f7b7462397fe9f477c4 (patch) | |
| tree | 805ac77f04ada1031c21bbfb7dd1e4885adfc2fa | |
| parent | 473c0a7be3a94a4c2d327d8539b9f203e4bfdd48 (diff) | |
vim: Update sh snippets
Add long getopts variant.
| -rw-r--r-- | files/.vim/UltiSnips/sh.snippets | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/files/.vim/UltiSnips/sh.snippets b/files/.vim/UltiSnips/sh.snippets index b06337f..f0df521 100644 --- a/files/.vim/UltiSnips/sh.snippets +++ b/files/.vim/UltiSnips/sh.snippets @@ -20,6 +20,21 @@ done shift $((OPTIND - 1)) endsnippet +snippet getoptsl +while [ $# -gt 0 ]; do + case "\$1" in + -h | --help) + usage + exit 0 + ;; + -*) + echo "Unknown option: \$1" + exit_with_usage + ;; + esac +done +endsnippet + snippet die die() { echo "\$1" >&2 |
