Skip to content

Commit e205feb

Browse files
committed
config: refresh implementation
1 parent da8b200 commit e205feb

File tree

1 file changed

+15
-21
lines changed

1 file changed

+15
-21
lines changed

share/pot/config.sh

+15-21
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
: "${_config_names:="fs_root zfs_root gateway syslogd pot_prefix fscomp_prefix"}"
44

5+
# shellcheck disable=SC2039
56
config-help()
67
{
78
echo 'pot config [-h][-v][-q] [-g name ]'
@@ -30,39 +31,32 @@ pot-config()
3031
local _quiet
3132
_quiet="NO"
3233
_get=
33-
if ! args=$(getopt hvqg: "$@") ; then
34-
config-help
35-
${EXIT} 1
36-
fi
37-
# shellcheck disable=SC2086
38-
set -- $args
39-
while true; do
40-
case "$1" in
41-
-h)
34+
OPTIND=1
35+
36+
while getopts "hvqg:" _o ; do
37+
case "$_o" in
38+
h)
4239
config-help
4340
${EXIT} 0
4441
;;
45-
-v)
42+
v)
4643
_POT_VERBOSITY=$(( _POT_VERBOSITY + 1))
47-
shift
4844
;;
49-
-q)
45+
q)
5046
_quiet="quiet"
51-
shift
5247
;;
53-
-g)
54-
if _is_in_list "$2" "$_config_names" ; then
55-
_get="$2"
48+
g)
49+
if _is_in_list "$OPTARG" "$_config_names" ; then
50+
_get="$OPTARG"
5651
else
57-
_qerror $_quiet "$2 is not a valid name"
52+
_qerror $_quiet "$OPTARG is not a valid name"
5853
[ "quiet" != "$_quiet" ] && config-help
5954
${EXIT} 1
6055
fi
61-
shift 2
6256
;;
63-
--)
64-
shift
65-
break
57+
*)
58+
config-help
59+
${EXIT} 1
6660
;;
6761
esac
6862
done

0 commit comments

Comments
 (0)