From 56d956bf7e89bbfae066b138a684d1a6b492feac Mon Sep 17 00:00:00 2001 From: Triston Armstrong Date: Mon, 11 Nov 2024 00:45:22 -0500 Subject: [PATCH] only print success/fail when cli not already installed --- cli.sh | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/cli.sh b/cli.sh index 24823f8..9243f8a 100755 --- a/cli.sh +++ b/cli.sh @@ -6,12 +6,17 @@ main(){ _install_cli(){ local name=$1; - bash ./warn.sh "Installing cli tool: $name" # v---- this skips already installed stuff - if (sudo pacman -S --needed "$name" --noconfirm >>/dev/null); then - bash ./success.sh "Successfully installed cli tool: $name" - else - bash ./error.sh "Failed: $name" - fi + if $(! command -v "$name" &> /dev/null); then + bash ./warn.sh "Installing cli tool: $name" + if (pacman -S --needed "$name" --noconfirm >>/dev/null); then + bash ./success.sh "Successfully installed cli tool: $name" + else + bash ./error.sh "Failed: $name" + fi + else + bash ./warn.sh "Skipping: $name" + fi + } run_cli_install(){ @@ -30,6 +35,8 @@ run_cli_install(){ "nodejs" # <-- hawk tuah "npm" # <-- need unfortunately for work stuff "zellij" # <-- multplexer + "lazygit" + "yazi-bin" ) for i in "${cli_tools[@]}"; do