♻️ Refactored init dependency check for git & curl
This commit is contained in:
parent
f5ee5d2fe4
commit
eaffa016c9
1 changed files with 14 additions and 3 deletions
17
scripts/bgit
17
scripts/bgit
|
|
@ -16,10 +16,21 @@ txtyellow=${txtbld}$(tput setaf 3)
|
|||
txtwhite=${txtbld}$(tput setaf 7)
|
||||
|
||||
# Dependency check
|
||||
if ! command -v git &> /dev/null
|
||||
dependencies=("git" "curl")
|
||||
numdependencies=2
|
||||
missingdependencies=0
|
||||
for ((i = 0; i < numdependencies; i++)) ;
|
||||
do
|
||||
if ! command -v "${dependencies[$i]}" &> /dev/null
|
||||
then
|
||||
echo "${txtred}dependency not met: ${dependencies[$i]}${txtwhite}"
|
||||
missingdependencies=$((missingdependencies+1))
|
||||
fi
|
||||
done
|
||||
|
||||
if [ $missingdependencies -gt 0 ] ;
|
||||
then
|
||||
echo "${txtred}dependency not met: git"
|
||||
echo "Please install needed depndencies${txtwhite}"
|
||||
echo "${txtred}Please install needed dependencies${txtwhite}"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue