Turn top-level Cargo.toml into a virtual manifest
This commit is contained in:
@ -1,17 +1,26 @@
|
||||
#!/usr/bin/env bash
|
||||
#
|
||||
# Outputs the current crate version
|
||||
# Outputs the current crate version from a given Cargo.toml
|
||||
#
|
||||
set -e
|
||||
|
||||
cd "$(dirname "$0")"/..
|
||||
Cargo_toml=$1
|
||||
[[ -n $Cargo_toml ]] || {
|
||||
echo "Usage: $0 path/to/Cargo.toml"
|
||||
exit 0
|
||||
}
|
||||
|
||||
[[ -r $Cargo_toml ]] || {
|
||||
echo "Error: unable to read $Cargo_toml"
|
||||
exit 1
|
||||
}
|
||||
|
||||
while read -r name equals value _; do
|
||||
if [[ $name = version && $equals = = ]]; then
|
||||
echo "${value//\"/}"
|
||||
exit 0
|
||||
fi
|
||||
done < <(cat Cargo.toml)
|
||||
done < <(cat "$Cargo_toml")
|
||||
|
||||
echo Unable to locate version in Cargo.toml 1>&2
|
||||
exit 1
|
||||
|
Reference in New Issue
Block a user