From b5c255b3c7de2951d9c6738bb9310ca1d7cc58e9 Mon Sep 17 00:00:00 2001 From: Shihaam Abdul Rahman Date: Mon, 7 Feb 2022 18:25:35 +0500 Subject: [PATCH] added dependecy check --- bml-cli | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/bml-cli b/bml-cli index ce1c2d8..82c7b7f 100755 --- a/bml-cli +++ b/bml-cli @@ -45,6 +45,16 @@ animate(){ printf "\r${@} [${anim:$h:1}]" done } +dependency_check(){ + for DEPENDENCY; do + if ! command -v "$DEPENDENCY" 1>/dev/null; then + printf "%s not found. Please install it.\n" "$DEPENDENCY" >&2 + exit 2 + fi + done + unset DEPENDENCY +} + initialize(){ echo initalizing.. mkdir -p ~/.config/bml-cli/ @@ -766,6 +776,7 @@ init_login(){ enter_credentials fi } +dependency_check "curl" "jq" "openssl" "perl" display_banner && check_connection #& animate "Checking Internet Connection" source $CONFIG source $CREDENTIALS