Skip to content

Commit 3b62871

Browse files
committed
update generated.sh
1 parent 5156621 commit 3b62871

File tree

1 file changed

+16
-6
lines changed

1 file changed

+16
-6
lines changed

generate/generate.sh

+16-6
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
#!/bin/bash -uex
22

3+
PROGNAME=$(basename $0)
4+
35
usage_exit() {
4-
echo "Usage: $0 [--download] [--docker-pull]" 1>&2
6+
echo "Usage: ${PROGNAME} [--download] [--docker-pull]" 1>&2
57
exit 1
68
}
79

@@ -12,18 +14,26 @@ if [ $# -gt 0 ]; then
1214
for OPT in "$@"
1315
do
1416
case ${OPT} in
15-
--download)
17+
"--download")
1618
FLAG_DOWNLOAD=true
19+
shift 1
1720
;;
18-
--docker-pull)
21+
"--docker-pull")
1922
FLAG_DOCKER_PULL=true
23+
shift 1
2024
;;
21-
--help|-h)
25+
"-h" | "--help")
2226
usage_exit
2327
;;
24-
28+
-*)
29+
echo "${PROGNAME}: illegal option $1" 1>&2
30+
exit 1
31+
;;
2532
*)
26-
usage_exit
33+
if [ -n "$1" ] && [[ ! "$1" =~ ^-+ ]]; then
34+
echo "${PROGNAME}: illegal parameter $1" 1>&2
35+
exit 1
36+
fi
2737
;;
2838
esac
2939
done

0 commit comments

Comments
 (0)