Test --help option if --version option is not available

This commit is contained in:
Taiki Endo
2023-06-20 01:20:34 +09:00
parent b0f46ac8be
commit 95a159ca13

25
main.sh
View File

@@ -555,23 +555,34 @@ for tool in "${tools[@]}"; do
esac esac
info "${tool} installed at $(type -P "${tool}${exe}")" info "${tool} installed at $(type -P "${tool}${exe}")"
# At least cargo-udeps 0.1.30 and wasm-pack 0.12.0 do not support --version option.
case "${tool}" in case "${tool}" in
cargo-*) cargo-*)
if type -P cargo &>/dev/null; then if type -P cargo &>/dev/null; then
case "${tool}" in case "${tool}" in
cargo-udeps) x cargo udeps --help | head -1 ;; # cargo-udeps v0.1.30 does not support --version option cargo-valgrind) x cargo "${tool#cargo-}" --help ;; # cargo-valgrind 2.1.0's --version option just calls cargo's --version option
cargo-valgrind) x cargo valgrind --help ;; # cargo-valgrind v2.1.0 does not support --version option *)
*) x cargo "${tool#cargo-}" --version ;; if ! x cargo "${tool#cargo-}" --version; then
x cargo "${tool#cargo-}" --help
fi
;;
esac esac
else else
case "${tool}" in case "${tool}" in
cargo-udeps) x "${tool}" udeps --help | head -1 ;; # cargo-udeps v0.1.30 does not support --version option cargo-valgrind) x "${tool}" "${tool#cargo-}" --help ;; # cargo-valgrind 2.1.0's --version option just calls cargo's --version option
cargo-valgrind) x "${tool}" valgrind --help ;; # cargo-valgrind v2.1.0 does not support --version option *)
*) x "${tool}" "${tool#cargo-}" --version ;; if ! x "${tool}" "${tool#cargo-}" --version; then
x "${tool}" "${tool#cargo-}" --help
fi
;;
esac esac
fi fi
;; ;;
*) x "${tool}" --version ;; *)
if ! x "${tool}" --version; then
x "${tool}" --help
fi
;;
esac esac
echo echo
done done