added dependecy check

This commit is contained in:
Shihaam Abdul Rahman 2022-02-07 18:25:35 +05:00
parent 1d053f1b66
commit b5c255b3c7

11
bml-cli
View File

@ -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