Skip to content
This repository has been archived by the owner on Feb 10, 2024. It is now read-only.

Commit

Permalink
Fix while..getopts variable name
Browse files Browse the repository at this point in the history
  • Loading branch information
Janfy committed Dec 15, 2016
1 parent 985964d commit adb651b
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 14 deletions.
8 changes: 4 additions & 4 deletions getopts-simple.sublime-snippet
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
<snippet>
<content><![CDATA[
while getopts :${1:?}h option
while getopts :${1:?}h arg
do
case \$option in
case \$arg in
${1})
${0:: #statements}
;;
:|?|h)
[[ \$option == \? ]] && print_error "L'option -\$OPTARG n'est pas prise en charge !"
[[ \$option == : ]] && print_error "L'option -\$OPTARG requiert un argument !"
[[ \$arg == \? ]] && print_error "L'option -\$OPTARG n'est pas prise en charge !"
[[ \$arg == : ]] && print_error "L'option -\$OPTARG requiert un argument !"
usage
exit \$([[ \$arg == h ]] && echo 0 || echo 2)
;;
Expand Down
10 changes: 5 additions & 5 deletions getopts.sublime-snippet
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<snippet>
<content><![CDATA[
while getopts :${1:?}a-:fqvh option
while getopts :${1:?}a-:fqvh arg
do
case \$option in
case \$arg in
-)
if [[ \${!OPTIND} == -* ]]
then
Expand Down Expand Up @@ -34,7 +34,7 @@ do
esac
;;
a)
[[ \$OPTARG == -* ]] && print_error "L'option -\$option requiert un argument !" && usage && exit 2
[[ \$OPTARG == -* ]] && print_error "L'option -\$arg requiert un argument !" && usage && exit 2
;;
${1})
Expand All @@ -54,8 +54,8 @@ do
;;
:|?|h)
[[ \$option == \? ]] && print_error "L'option -\$OPTARG n'est pas prise en charge !"
[[ \$option == : ]] && print_error "L'option -\$OPTARG requiert un argument !"
[[ \$arg == \? ]] && print_error "L'option -\$OPTARG n'est pas prise en charge !"
[[ \$arg == : ]] && print_error "L'option -\$OPTARG requiert un argument !"
usage
exit \$([[ \$arg == h ]] && echo 0 || echo 2)
;;
Expand Down
10 changes: 5 additions & 5 deletions new-task.sublime-snippet
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@ usage() {
EOF
}
while getopts :${3:?}a-:fqvh option
while getopts :${3:?}a-:fqvh arg
do
case \$option in
case \$arg in
-)
if [[ \${!OPTIND} == -* ]]
then
Expand Down Expand Up @@ -65,7 +65,7 @@ do
esac
;;
a)
[[ \$OPTARG == -* ]] && print_error "L'option -\$option requiert un argument !" && usage && exit 2
[[ \$OPTARG == -* ]] && print_error "L'option -\$arg requiert un argument !" && usage && exit 2
;;
${3})
Expand All @@ -85,8 +85,8 @@ do
;;
:|?|h)
[[ \$option == \? ]] && print_error "L'option -\$OPTARG n'est pas prise en charge !"
[[ \$option == : ]] && print_error "L'option -\$OPTARG requiert un argument !"
[[ \$arg == \? ]] && print_error "L'option -\$OPTARG n'est pas prise en charge !"
[[ \$arg == : ]] && print_error "L'option -\$OPTARG requiert un argument !"
usage
exit 2
;;
Expand Down

0 comments on commit adb651b

Please sign in to comment.