Skip to content

Commit

Permalink
better diagnostic messages
Browse files Browse the repository at this point in the history
  • Loading branch information
romkatv committed Mar 26, 2020
1 parent c58946e commit 3b39c8c
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 28 deletions.
32 changes: 16 additions & 16 deletions build
Original file line number Diff line number Diff line change
Expand Up @@ -462,29 +462,29 @@ cat >"$workdir/$name"/share/zsh/5.8/scripts/relocate <<-\END
;;
s)
if [ -n "$src" ]; then
>&2 echo "[error] duplicate option: $opt"
>&2 echo "[error] duplicate option: -$opt"
exit 1
fi
if [ -z "$OPTARG" ]; then
>&2 echo "[error] incorrect value of $opt: $OPTARG"
>&2 echo "[error] incorrect value of -$opt: $OPTARG"
exit 1
fi
src="$OPTARG"
;;
d)
if [ -n "$dst" ]; then
>&2 echo "[error] duplicate option: $opt"
>&2 echo "[error] duplicate option: -$opt"
exit 1
fi
if [ -z "$OPTARG" ]; then
>&2 echo "[error] incorrect value of $opt: $OPTARG"
>&2 echo "[error] incorrect value of -$opt: $OPTARG"
exit 1
fi
dst="$OPTARG"
;;
\?) >&2 echo "[error] invalid option: $OPTARG" ; exit 1;;
:) >&2 echo "[error] missing required argument: $OPTARG"; exit 1;;
*) >&2 echo "[internal error] unhandled option: $opt" ; exit 1;;
\?) >&2 echo "[error] invalid option: -$OPTARG" ; exit 1;;
:) >&2 echo "[error] missing required argument: -$OPTARG"; exit 1;;
*) >&2 echo "[internal error] unhandled option: -$opt" ; exit 1;;
esac
done
Expand Down Expand Up @@ -704,40 +704,40 @@ while getopts ':m:c:i:h' opt "$@"; do
;;
m)
if [ -n "$ZSH_BIN_ARCH" ]; then
>&2 echo "[error] duplicate option: $opt"
>&2 echo "[error] duplicate option: -$opt"
exit 1
fi
if [ -z "$OPTARG" ]; then
>&2 echo "[error] incorrect value of $opt: $OPTARG"
>&2 echo "[error] incorrect value of -$opt: $OPTARG"
exit 1
fi
ZSH_BIN_ARCH="$OPTARG"
;;
c)
if [ -n "$ZSH_BIN_CPU" ]; then
>&2 echo "[error] duplicate option: $opt"
>&2 echo "[error] duplicate option: -$opt"
exit 1
fi
if [ -z "$OPTARG" ]; then
>&2 echo "[error] incorrect value of $opt: $OPTARG"
>&2 echo "[error] incorrect value of -$opt: $OPTARG"
exit 1
fi
ZSH_BIN_CPU="$OPTARG"
;;
i)
if [ -n "$ZSH_BIN_IMAGE" ]; then
>&2 echo "[error] duplicate option: $opt"
>&2 echo "[error] duplicate option: -$opt"
exit 1
fi
if [ -z "$OPTARG" ]; then
>&2 echo "[error] incorrect value of $opt: $OPTARG"
>&2 echo "[error] incorrect value of -$opt: $OPTARG"
exit 1
fi
ZSH_BIN_IMAGE="$OPTARG"
;;
\?) >&2 echo "[error] invalid option: $OPTARG" ; exit 1;;
:) >&2 echo "[error] missing required argument: $OPTARG"; exit 1;;
*) >&2 echo "[internal error] unhandled option: $opt" ; exit 1;;
\?) >&2 echo "[error] invalid option: -$OPTARG" ; exit 1;;
:) >&2 echo "[error] missing required argument: -$OPTARG"; exit 1;;
*) >&2 echo "[internal error] unhandled option: -$opt" ; exit 1;;
esac
done
Expand Down
24 changes: 12 additions & 12 deletions install
Original file line number Diff line number Diff line change
Expand Up @@ -97,18 +97,18 @@ while getopts ':hqd:a:f:u:' opt "$@"; do
;;
q)
if [ -n "$quiet" ]; then
>&2 echo "[error] duplicate option: $opt"
>&2 echo "[error] duplicate option: -$opt"
exit 1
fi
quiet=1
;;
d)
if [ -n "$dir" ]; then
>&2 echo "[error] duplicate option: $opt"
>&2 echo "[error] duplicate option: -$opt"
exit 1
fi
if [ -z "$OPTARG" ]; then
>&2 echo "[error] incorrect value of $opt: $OPTARG"
>&2 echo "[error] incorrect value of -$opt: $OPTARG"
exit 1
fi
dir="$OPTARG"
Expand All @@ -117,24 +117,24 @@ while getopts ':hqd:a:f:u:' opt "$@"; do
case "$OPTARG" in
sha256|md5)
if [ -n "$algos" -a -z "${algos##*$OPTARG*}" ]; then
>&2 echo "[error] duplicate option: $opt $OPTARG"
>&2 echo "[error] duplicate option: -$opt $OPTARG"
exit 1
fi
algos="$algos $OPTARG"
;;
*)
>&2 echo "[error] incorrect value of $opt: $OPTARG"
>&2 echo "[error] incorrect value of -$opt: $OPTARG"
exit 1
;;
esac
;;
f)
if [ -n "$file" ]; then
>&2 echo "[error] duplicate option: $opt"
>&2 echo "[error] duplicate option: -$opt"
exit 1
fi
if [ -z "$OPTARG" ]; then
>&2 echo "[error] incorrect value of $opt: $OPTARG"
>&2 echo "[error] incorrect value of -$opt: $OPTARG"
exit 1
fi
if ! file="$(absfile "$OPTARG")"; then
Expand All @@ -144,18 +144,18 @@ while getopts ':hqd:a:f:u:' opt "$@"; do
;;
u)
if [ -n "$url" ]; then
>&2 echo "[error] duplicate option: $opt"
>&2 echo "[error] duplicate option: -$opt"
exit 1
fi
if [ -z "$OPTARG" ]; then
>&2 echo "[error] incorrect value of $opt: $OPTARG"
>&2 echo "[error] incorrect value of -$opt: $OPTARG"
exit 1
fi
url="$OPTARG"
;;
\?) >&2 echo "[error] invalid option: $OPTARG" ; exit 1;;
:) >&2 echo "[error] missing required argument: $OPTARG"; exit 1;;
*) >&2 echo "[internal error] unhandled option: $opt" ; exit 1;;
\?) >&2 echo "[error] invalid option: -$OPTARG" ; exit 1;;
:) >&2 echo "[error] missing required argument: -$OPTARG"; exit 1;;
*) >&2 echo "[internal error] unhandled option: -$opt" ; exit 1;;
esac
done

Expand Down

0 comments on commit 3b39c8c

Please sign in to comment.