add zsh.snippets, add getopts snippet

This commit is contained in:
hophacker 2019-08-14 16:37:07 +08:00
parent 66e85088ed
commit d6c2ef8cfe

View File

@ -0,0 +1,18 @@
snippet getopts "Deal with shell parameters" b
BOOL=false
VAVLUE=''
while getopts ":bv:" o; do
case "${o}" in
b)
BOOL=true
;;
v)
VALUE=${OPTARG}
;;
*)
echo "Usage: $1 [-b] [-v VALUE]"
return
;;
esac
done
endsnippet