Skip to content

Instantly share code, notes, and snippets.

@jagipson
Created May 27, 2020 20:03
Show Gist options
  • Save jagipson/1a873ff9744ad61627dc04c143c9b540 to your computer and use it in GitHub Desktop.
Save jagipson/1a873ff9744ad61627dc04c143c9b540 to your computer and use it in GitHub Desktop.
yas snippet for bash while getopts
# -*- mode: snippet -*-
# name: wgetopts
# key: wgetopts
# ${1:$(mapconcat (lambda (c) (format "%c)\n\t: #TODO: Implement option\n\t;;\n\n" c)) yas-text "")}
# --
while getopts ":${1:opts}"; do
case opt in
${1:$(mapconcat (lambda (c) (format "%c)\n\t: #TODO: Implement option\n\t;;\n\n" c)) (replace-regexp-in-string ":" "" yas-text) "")}
*)
usage
;;
esac
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment