15 lines
322 B
Bash
15 lines
322 B
Bash
# source this file
|
|
|
|
readCargoVariable() {
|
|
declare variable="$1"
|
|
declare Cargo_toml="$2"
|
|
|
|
while read -r name equals value _; do
|
|
if [[ $name = "$variable" && $equals = = ]]; then
|
|
echo "${value//\"/}"
|
|
return
|
|
fi
|
|
done < <(cat "$Cargo_toml")
|
|
echo "Unable to locate $variable in $Cargo_toml" 1>&2
|
|
}
|