zed/script/get-crate-version

17 lines
269 B
Plaintext
Raw Permalink Normal View History

2022-10-26 00:24:20 +03:00
#!/bin/bash
set -eu
if [[ $# < 1 ]]; then
echo "Usage: $0 <crate_name>" >&2
exit 1
fi
CRATE_NAME=$1
cargo metadata \
--no-deps \
--format-version=1 \
| jq \
--raw-output \
".packages[] | select(.name == \"${CRATE_NAME}\") | .version"