Skip to content

Commit bb3d86c

Browse files
committed
Clean up --version calls
1 parent 28bb099 commit bb3d86c

File tree

1 file changed

+19
-22
lines changed

1 file changed

+19
-22
lines changed

main.sh

Lines changed: 19 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -576,35 +576,32 @@ for tool in "${tools[@]}"; do
576576
;;
577577
esac
578578

579-
info "${tool} installed at $(type -P "${tool}${exe}")"
580-
# At least cargo-udeps 0.1.30 and wasm-pack 0.12.0 do not support --version option.
581579
case "${tool}" in
582-
cargo-careful) ;; # cargo-careful 0.3.4 does not support neither --version nor --help option.
580+
xbuild) tool_bin="x" ;;
581+
*) tool_bin="${tool}" ;;
582+
esac
583+
info "${tool} installed at $(type -P "${tool_bin}${exe}")"
584+
# cargo-udeps 0.1.30 and wasm-pack 0.12.0 do not support --version option.
585+
case "${tool}" in
586+
cargo-careful | cargo-machete) ;; # cargo-careful 0.3.4 and cargo-machete 0.5.0 do not support neither --version nor --help option.
583587
cargo-*)
584588
if type -P cargo &>/dev/null; then
585-
case "${tool}" in
586-
cargo-valgrind) rx cargo "${tool#cargo-}" --help ;; # cargo-valgrind 2.1.0's --version option just calls cargo's --version option
587-
*)
588-
if ! rx cargo "${tool#cargo-}" --version; then
589-
rx cargo "${tool#cargo-}" --help
590-
fi
591-
;;
592-
esac
589+
_cargo=cargo
593590
else
594-
case "${tool}" in
595-
cargo-valgrind) rx "${tool}" "${tool#cargo-}" --help ;; # cargo-valgrind 2.1.0's --version option just calls cargo's --version option
596-
*)
597-
if ! rx "${tool}" "${tool#cargo-}" --version; then
598-
rx "${tool}" "${tool#cargo-}" --help
599-
fi
600-
;;
601-
esac
591+
_cargo="${tool}"
602592
fi
593+
case "${tool}" in
594+
cargo-valgrind) rx "${_cargo}" "${tool#cargo-}" --help ;; # cargo-valgrind 2.1.0's --version option just calls cargo's --version option
595+
*)
596+
if ! rx "${_cargo}" "${tool#cargo-}" --version; then
597+
rx "${_cargo}" "${tool#cargo-}" --help
598+
fi
599+
;;
600+
esac
603601
;;
604-
xbuild) rx "x" --version ;;
605602
*)
606-
if ! rx "${tool}" --version; then
607-
rx "${tool}" --help
603+
if ! rx "${tool_bin}" --version; then
604+
rx "${tool_bin}" --help
608605
fi
609606
;;
610607
esac

0 commit comments

Comments
 (0)