♻️ Refactored based off of remote handling
This commit is contained in:
parent
e618f80155
commit
e2a821aa08
1 changed files with 14 additions and 28 deletions
42
scripts/bgit
42
scripts/bgit
|
|
@ -17,12 +17,17 @@ txtyellow=${txtbld}$(tput setaf 3)
|
|||
txtwhite=${txtbld}$(tput setaf 7)
|
||||
|
||||
# Dependency check
|
||||
if ! command -v git &> /dev/null
|
||||
then
|
||||
echo "${txtred}dependency not met: git"
|
||||
echo "Please install needed depndencies${txtwhite}"
|
||||
exit 1
|
||||
fi
|
||||
dependencies=("xclip" "git")
|
||||
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
|
||||
|
||||
# Intro Prompt
|
||||
echo "${txtblue}bgit: a handy shell script for automating simple git inits/commits"
|
||||
|
|
@ -199,21 +204,10 @@ if [ $numrepos -eq 0 ] ; then
|
|||
if [[ $crepo == 'y' || $crepo == 'yes' ]] ; then
|
||||
|
||||
# Dependency check
|
||||
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 ] ;
|
||||
if ! command -v curl &> /dev/null
|
||||
then
|
||||
echo "${txtred}Please install needed dependencies${txtwhite}"
|
||||
echo "${txtred}dependency not met: curl"
|
||||
echo "Please install needed depndencies${txtwhite}"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
|
@ -249,8 +243,6 @@ if [ $numrepos -eq 0 ] ; then
|
|||
# Otherwise, if there already is a .git directory...
|
||||
else
|
||||
|
||||
# creates a list of repos and puts them in an array
|
||||
# remotearray=($(git remote))
|
||||
# Grabs all new files
|
||||
newfiles=$(git status --short | grep '??' | awk '{print $2}' | tr '\n' ' ')
|
||||
# Grabs all modified files
|
||||
|
|
@ -297,9 +289,6 @@ else
|
|||
|
||||
# and pushes it to remote repository
|
||||
git remote | xargs -L1 git push --all
|
||||
# for ((i = 0; i < numrepos; i++)) ; do
|
||||
# git push --force ${remotearray[i]} ;
|
||||
# done
|
||||
|
||||
echo "${txtblue}bgit script has completed! goodbye!${txtwhite}"
|
||||
exit 0
|
||||
|
|
@ -401,9 +390,6 @@ else
|
|||
|
||||
# pushes the commit to each repository
|
||||
git remote | xargs -L1 git push --all
|
||||
# for ((i = 0; i < numrepos; i++)) ; do
|
||||
# git push ${remotearray[i]} ;
|
||||
# done
|
||||
|
||||
echo "${txtblue}bgit script has completed! goodbye!${txtwhite}"
|
||||
exit 0
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue