File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -8,18 +8,18 @@ if ! command -v hyperfine > /dev/null 2>&1; then
88 exit 1
99fi
1010
11- # Determine the target directories.
12- get_target_dir () {
13- if [[ -f " $HOME /.cargo/config" ]]; then
14- grep ' target-dir[[:space:]]*=' " $HOME /.cargo/config" \
15- | sed ' s/^[[:space:]]*target-dir[[:space:]]*=//; s/^[[:space:]]*"//; s/"[[:space:]]*$//' \
16- && return 0
17- fi
11+ # Check that jq is installed.
12+ if ! command -v jq > /dev/null 2>&1 ; then
13+ echo " 'jq' does not seem to be installed."
14+ echo " You can get it here: https://stedolan.github.io/jq"
15+ exit 1
16+ fi
1817
19- echo " ../../target"
18+ get_cargo_target_dir () {
19+ cargo metadata --no-deps --format-version 1 | jq -r .target_directory
2020}
2121
22- TARGET_DIR=" $( get_target_dir ) "
22+ TARGET_DIR=" $( get_cargo_target_dir ) "
2323TARGET_DEBUG=" ${TARGET_DIR} /debug/bat"
2424TARGET_RELEASE=" ${TARGET_DIR} /release/bat"
2525
You can’t perform that action at this time.
0 commit comments