From b4dd29d5ba1d4a21545da1862bfb9fede427ba13 Mon Sep 17 00:00:00 2001 From: Yuri Astrakhan Date: Mon, 5 Feb 2024 21:49:36 -0500 Subject: [PATCH] justfile improvement and deps --- Cargo.lock | 4 ++-- justfile | 13 ++++++++++--- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 60b2a660..6829ba74 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1634,9 +1634,9 @@ dependencies = [ [[package]] name = "hermit-abi" -version = "0.3.4" +version = "0.3.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5d3d0e0f38255e7fa3cf31335b3a56f05febd18025f4db5ef7a0cfb4f8da651f" +checksum = "d0c62115964e08cb8039170eb33c1d0e2388a256930279edca206fff675f82c3" [[package]] name = "hex" diff --git a/justfile b/justfile index ac5576d6..aa26bdad 100644 --- a/justfile +++ b/justfile @@ -344,7 +344,14 @@ install-sqlx: (cargo-install "cargo-sqlx" "sqlx-cli" "--no-default-features" "-- # Check if a certain Cargo command is installed, and install it if needed [private] cargo-install $COMMAND $INSTALL_CMD="" *ARGS="": - @if ! command -v $COMMAND &> /dev/null; then \ - echo "$COMMAND could not be found. Installing it with cargo install ${INSTALL_CMD:-$COMMAND} {{ ARGS }}" ;\ - cargo install ${INSTALL_CMD:-$COMMAND} {{ ARGS }} ;\ + #!/usr/bin/env sh + set -eu + if [ ! command -v $COMMAND &> /dev/null ]; then + if [ ! command -v cargo-binstall &> /dev/null ]; then + echo "$COMMAND could not be found. Installing it with cargo install ${INSTALL_CMD:-$COMMAND} {{ ARGS }}" + cargo install ${INSTALL_CMD:-$COMMAND} {{ ARGS }} + else + echo "$COMMAND could not be found. Installing it with cargo binstall ${INSTALL_CMD:-$COMMAND} {{ ARGS }}" + cargo binstall ${INSTALL_CMD:-$COMMAND} {{ ARGS }} + fi fi