mirror of
https://github.com/sharkdp/bat
synced 2025-02-19 22:38:30 +00:00
Simplify cargo-target-dir extraction
This commit is contained in:
parent
1822c981da
commit
ea2faf45e4
1 changed files with 9 additions and 9 deletions
18
tests/benchmarks/run-benchmarks.sh
vendored
18
tests/benchmarks/run-benchmarks.sh
vendored
|
@ -8,18 +8,18 @@ if ! command -v hyperfine > /dev/null 2>&1; then
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Determine the target directories.
|
# Check that jq is installed.
|
||||||
get_target_dir() {
|
if ! command -v jq > /dev/null 2>&1; then
|
||||||
if [[ -f "$HOME/.cargo/config" ]]; then
|
echo "'jq' does not seem to be installed."
|
||||||
grep 'target-dir[[:space:]]*=' "$HOME/.cargo/config" \
|
echo "You can get it here: https://stedolan.github.io/jq"
|
||||||
| sed 's/^[[:space:]]*target-dir[[:space:]]*=//; s/^[[:space:]]*"//; s/"[[:space:]]*$//' \
|
exit 1
|
||||||
&& return 0
|
fi
|
||||||
fi
|
|
||||||
|
|
||||||
echo "../../target"
|
get_cargo_target_dir() {
|
||||||
|
cargo metadata --no-deps --format-version 1 | jq -r .target_directory
|
||||||
}
|
}
|
||||||
|
|
||||||
TARGET_DIR="$(get_target_dir)"
|
TARGET_DIR="$(get_cargo_target_dir)"
|
||||||
TARGET_DEBUG="${TARGET_DIR}/debug/bat"
|
TARGET_DEBUG="${TARGET_DIR}/debug/bat"
|
||||||
TARGET_RELEASE="${TARGET_DIR}/release/bat"
|
TARGET_RELEASE="${TARGET_DIR}/release/bat"
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue