♻️ Refactgored where dependency check for curl is
This commit is contained in:
parent
eaffa016c9
commit
d9ac293887
1 changed files with 17 additions and 21 deletions
38
scripts/bgit
38
scripts/bgit
|
|
@ -16,28 +16,13 @@ txtyellow=${txtbld}$(tput setaf 3)
|
||||||
txtwhite=${txtbld}$(tput setaf 7)
|
txtwhite=${txtbld}$(tput setaf 7)
|
||||||
|
|
||||||
# Dependency check
|
# Dependency check
|
||||||
dependencies=("git" "curl")
|
if ! command -v git &> /dev/null
|
||||||
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
|
then
|
||||||
echo "${txtred}Please install needed dependencies${txtwhite}"
|
echo "${txtred}dependency not met: git"
|
||||||
|
echo "Please install needed depndencies${txtwhite}"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Time to rewrite new version:
|
|
||||||
# Features to include:
|
|
||||||
# setopts/getopts flags for init,delete repos ( see git_create...txt file in notes)
|
|
||||||
|
|
||||||
# Intro Prompt
|
# Intro Prompt
|
||||||
echo "${txtblue}bgit: a handy shell script for automating simple git inits/commits"
|
echo "${txtblue}bgit: a handy shell script for automating simple git inits/commits"
|
||||||
|
|
||||||
|
|
@ -212,10 +197,21 @@ if [ $numrepos -eq 0 ] ; then
|
||||||
if [[ $crepo == 'y' || $crepo == 'yes' ]] ; then
|
if [[ $crepo == 'y' || $crepo == 'yes' ]] ; then
|
||||||
|
|
||||||
# Dependency check
|
# Dependency check
|
||||||
if ! command -v xclip &> /dev/null
|
dependencies=("xclip" "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
|
then
|
||||||
echo "${txtred}dependency not met: xclip"
|
echo "${txtred}Please install needed dependencies${txtwhite}"
|
||||||
echo "Please install needed depndencies${txtwhite}"
|
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue