Skip to content

Commit 134667b

Browse files
fix(docs): guard update_versions.sh flags against missing values
Address review feedback from coderabbitai on hack/update_versions.sh:46: --dest/--branch/--cozystack-tag now emit a clear usage error instead of tripping set -u ("unbound variable") when a flag is passed without a value. Signed-off-by: Myasnikov Daniil <[email protected]>
1 parent 1c3cb2b commit 134667b

1 file changed

Lines changed: 13 additions & 3 deletions

File tree

‎hack/update_versions.sh‎

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,19 @@ COZYSTACK_TAG=""
3838
# -------------------- Parse arguments --------------------
3939
while [[ $# -gt 0 ]]; do
4040
case "$1" in
41-
--dest) DEST="$2"; shift 2 ;;
42-
--branch) BRANCH="$2"; shift 2 ;;
43-
--cozystack-tag) COZYSTACK_TAG="$2"; shift 2 ;;
41+
--dest|--branch|--cozystack-tag)
42+
# Guard the value-taking flags: without this, a missing value makes the
43+
# `$2` read trip `set -u` ("unbound variable") instead of a clean usage error.
44+
if [[ $# -lt 2 ]]; then
45+
echo "Error: $1 requires a value." >&2
46+
usage; exit 1
47+
fi
48+
case "$1" in
49+
--dest) DEST="$2" ;;
50+
--branch) BRANCH="$2" ;;
51+
--cozystack-tag) COZYSTACK_TAG="$2" ;;
52+
esac
53+
shift 2 ;;
4454
-h|--help) usage; exit 0 ;;
4555
*) echo "Unknown argument: $1" >&2; usage; exit 1 ;;
4656
esac

0 commit comments

Comments
 (0)