Skip to content

Commit efeb6e6

Browse files
committed
Use jq to validate and format the rust-version
This is clearer than the inline shell script previously used, and also more robust.
1 parent 654a8fa commit efeb6e6

File tree

1 file changed

+10
-13
lines changed

1 file changed

+10
-13
lines changed

justfile

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -242,19 +242,16 @@ check-size:
242242
etc/check-package-size.sh
243243

244244
# Report the Minimum Supported Rust Version (the `rust-version` of `gix`) in X.Y.Z form
245-
msrv:
246-
set -eu; \
247-
query='.packages[] | select(.name == "gix") | .rust_version'; \
248-
value="$({{ j }} get-metadata "$query")"; \
249-
case "$value" in \
250-
*.*.*) \
251-
echo "$value" ;; \
252-
*.*) \
253-
echo "$value.0" ;; \
254-
*) \
255-
echo "No '.' in gix rust-version '$value'" >&2; \
256-
exit 1 ;; \
257-
esac
245+
msrv: (get-metadata '''
246+
(.packages[] | select(.name == "gix") | .rust_version | tostring) as $v |
247+
if ($v | test("^[0-9]+\\.[0-9]+\\.[0-9]+$")) then
248+
$v
249+
elif ($v | test("^[0-9]+\\.[0-9]+$")) then
250+
$v + ".0"
251+
else
252+
error("Unrecognized rust-version format: " + $v)
253+
end
254+
''')
258255
259256
# Regenerate the MSRV badge SVG
260257
msrv-badge:

0 commit comments

Comments
 (0)