Skip to content

Commit 3b39c8c

Browse files
committed
better diagnostic messages
1 parent c58946e commit 3b39c8c

File tree

2 files changed

+28
-28
lines changed

2 files changed

+28
-28
lines changed

build

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -462,29 +462,29 @@ cat >"$workdir/$name"/share/zsh/5.8/scripts/relocate <<-\END
462462
;;
463463
s)
464464
if [ -n "$src" ]; then
465-
>&2 echo "[error] duplicate option: $opt"
465+
>&2 echo "[error] duplicate option: -$opt"
466466
exit 1
467467
fi
468468
if [ -z "$OPTARG" ]; then
469-
>&2 echo "[error] incorrect value of $opt: $OPTARG"
469+
>&2 echo "[error] incorrect value of -$opt: $OPTARG"
470470
exit 1
471471
fi
472472
src="$OPTARG"
473473
;;
474474
d)
475475
if [ -n "$dst" ]; then
476-
>&2 echo "[error] duplicate option: $opt"
476+
>&2 echo "[error] duplicate option: -$opt"
477477
exit 1
478478
fi
479479
if [ -z "$OPTARG" ]; then
480-
>&2 echo "[error] incorrect value of $opt: $OPTARG"
480+
>&2 echo "[error] incorrect value of -$opt: $OPTARG"
481481
exit 1
482482
fi
483483
dst="$OPTARG"
484484
;;
485-
\?) >&2 echo "[error] invalid option: $OPTARG" ; exit 1;;
486-
:) >&2 echo "[error] missing required argument: $OPTARG"; exit 1;;
487-
*) >&2 echo "[internal error] unhandled option: $opt" ; exit 1;;
485+
\?) >&2 echo "[error] invalid option: -$OPTARG" ; exit 1;;
486+
:) >&2 echo "[error] missing required argument: -$OPTARG"; exit 1;;
487+
*) >&2 echo "[internal error] unhandled option: -$opt" ; exit 1;;
488488
esac
489489
done
490490
@@ -704,40 +704,40 @@ while getopts ':m:c:i:h' opt "$@"; do
704704
;;
705705
m)
706706
if [ -n "$ZSH_BIN_ARCH" ]; then
707-
>&2 echo "[error] duplicate option: $opt"
707+
>&2 echo "[error] duplicate option: -$opt"
708708
exit 1
709709
fi
710710
if [ -z "$OPTARG" ]; then
711-
>&2 echo "[error] incorrect value of $opt: $OPTARG"
711+
>&2 echo "[error] incorrect value of -$opt: $OPTARG"
712712
exit 1
713713
fi
714714
ZSH_BIN_ARCH="$OPTARG"
715715
;;
716716
c)
717717
if [ -n "$ZSH_BIN_CPU" ]; then
718-
>&2 echo "[error] duplicate option: $opt"
718+
>&2 echo "[error] duplicate option: -$opt"
719719
exit 1
720720
fi
721721
if [ -z "$OPTARG" ]; then
722-
>&2 echo "[error] incorrect value of $opt: $OPTARG"
722+
>&2 echo "[error] incorrect value of -$opt: $OPTARG"
723723
exit 1
724724
fi
725725
ZSH_BIN_CPU="$OPTARG"
726726
;;
727727
i)
728728
if [ -n "$ZSH_BIN_IMAGE" ]; then
729-
>&2 echo "[error] duplicate option: $opt"
729+
>&2 echo "[error] duplicate option: -$opt"
730730
exit 1
731731
fi
732732
if [ -z "$OPTARG" ]; then
733-
>&2 echo "[error] incorrect value of $opt: $OPTARG"
733+
>&2 echo "[error] incorrect value of -$opt: $OPTARG"
734734
exit 1
735735
fi
736736
ZSH_BIN_IMAGE="$OPTARG"
737737
;;
738-
\?) >&2 echo "[error] invalid option: $OPTARG" ; exit 1;;
739-
:) >&2 echo "[error] missing required argument: $OPTARG"; exit 1;;
740-
*) >&2 echo "[internal error] unhandled option: $opt" ; exit 1;;
738+
\?) >&2 echo "[error] invalid option: -$OPTARG" ; exit 1;;
739+
:) >&2 echo "[error] missing required argument: -$OPTARG"; exit 1;;
740+
*) >&2 echo "[internal error] unhandled option: -$opt" ; exit 1;;
741741
esac
742742
done
743743

install

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -97,18 +97,18 @@ while getopts ':hqd:a:f:u:' opt "$@"; do
9797
;;
9898
q)
9999
if [ -n "$quiet" ]; then
100-
>&2 echo "[error] duplicate option: $opt"
100+
>&2 echo "[error] duplicate option: -$opt"
101101
exit 1
102102
fi
103103
quiet=1
104104
;;
105105
d)
106106
if [ -n "$dir" ]; then
107-
>&2 echo "[error] duplicate option: $opt"
107+
>&2 echo "[error] duplicate option: -$opt"
108108
exit 1
109109
fi
110110
if [ -z "$OPTARG" ]; then
111-
>&2 echo "[error] incorrect value of $opt: $OPTARG"
111+
>&2 echo "[error] incorrect value of -$opt: $OPTARG"
112112
exit 1
113113
fi
114114
dir="$OPTARG"
@@ -117,24 +117,24 @@ while getopts ':hqd:a:f:u:' opt "$@"; do
117117
case "$OPTARG" in
118118
sha256|md5)
119119
if [ -n "$algos" -a -z "${algos##*$OPTARG*}" ]; then
120-
>&2 echo "[error] duplicate option: $opt $OPTARG"
120+
>&2 echo "[error] duplicate option: -$opt $OPTARG"
121121
exit 1
122122
fi
123123
algos="$algos $OPTARG"
124124
;;
125125
*)
126-
>&2 echo "[error] incorrect value of $opt: $OPTARG"
126+
>&2 echo "[error] incorrect value of -$opt: $OPTARG"
127127
exit 1
128128
;;
129129
esac
130130
;;
131131
f)
132132
if [ -n "$file" ]; then
133-
>&2 echo "[error] duplicate option: $opt"
133+
>&2 echo "[error] duplicate option: -$opt"
134134
exit 1
135135
fi
136136
if [ -z "$OPTARG" ]; then
137-
>&2 echo "[error] incorrect value of $opt: $OPTARG"
137+
>&2 echo "[error] incorrect value of -$opt: $OPTARG"
138138
exit 1
139139
fi
140140
if ! file="$(absfile "$OPTARG")"; then
@@ -144,18 +144,18 @@ while getopts ':hqd:a:f:u:' opt "$@"; do
144144
;;
145145
u)
146146
if [ -n "$url" ]; then
147-
>&2 echo "[error] duplicate option: $opt"
147+
>&2 echo "[error] duplicate option: -$opt"
148148
exit 1
149149
fi
150150
if [ -z "$OPTARG" ]; then
151-
>&2 echo "[error] incorrect value of $opt: $OPTARG"
151+
>&2 echo "[error] incorrect value of -$opt: $OPTARG"
152152
exit 1
153153
fi
154154
url="$OPTARG"
155155
;;
156-
\?) >&2 echo "[error] invalid option: $OPTARG" ; exit 1;;
157-
:) >&2 echo "[error] missing required argument: $OPTARG"; exit 1;;
158-
*) >&2 echo "[internal error] unhandled option: $opt" ; exit 1;;
156+
\?) >&2 echo "[error] invalid option: -$OPTARG" ; exit 1;;
157+
:) >&2 echo "[error] missing required argument: -$OPTARG"; exit 1;;
158+
*) >&2 echo "[internal error] unhandled option: -$opt" ; exit 1;;
159159
esac
160160
done
161161

0 commit comments

Comments
 (0)