hamacs/snippets/sh-mode/getopt
Howard Abrams 513f2f06de Let's go ... first commit after a major refactor
Why yes, this will look like it sprung, like Athena, fully grown and
in armor from my head, but this is really just the mid-point of a new
endeavor.
2021-11-02 12:09:41 -07:00

15 lines
227 B
Text

# -*- mode: snippet -*-
# name: getopt
# uuid:
# key: getopt
# --
${1:OPT1}="${2:default value}"
$0
while getopts "${3:s}" o
do case "$o" in
$3) $1="$OPTARG";;
[?]) usage;;
esac
done
shift $(expr $OPTIND - 1)