✨ Finishing up bgit
This commit is contained in:
parent
607b692b50
commit
a090142f68
1 changed files with 48 additions and 20 deletions
68
scripts/bgit
68
scripts/bgit
|
|
@ -41,7 +41,7 @@ tput bold & tput setaf 7
|
|||
|
||||
function bgit() {
|
||||
# Intro Prompt
|
||||
echo -e "${txtblue} bgit: a handy shell script for git inits/commits${txtred}\n"
|
||||
echo "${txtblue} bgit: a handy shell script for git inits/commits${txtred}"
|
||||
|
||||
numrepos=$(git remote | wc -l)
|
||||
numargs="$#"
|
||||
|
|
@ -139,7 +139,7 @@ function bgit() {
|
|||
for ((i = 0; i < numrepos; i++)) ; do
|
||||
git push --force ${remotearray[i]} > /dev/null 2>&1;
|
||||
done
|
||||
echo -e "\n${txtblue} bgit script has completed! goodbye!${txtwhite}"
|
||||
echo "${txtblue} bgit script has completed! goodbye!${txtwhite}"
|
||||
exit 0
|
||||
|
||||
elif [[ $change == "n" || $change == "no" ]] ; then
|
||||
|
|
@ -157,25 +157,53 @@ function bgit() {
|
|||
fi
|
||||
done
|
||||
|
||||
elif [[ $numrepos -eq 0 || $numargs -eq 1 && $1 == "-i" || $1 == "--init" ]] ; then
|
||||
if [[ $numrepos -eq 0 ]] ; then
|
||||
echo "${txtgreen} no git repository found, executing git init...${txtwhite}"
|
||||
source $HOME/.config/bgit/bgit_init
|
||||
b_init "$@"
|
||||
else
|
||||
echo "${txtred} git repository already here..."
|
||||
source $HOME/.config/bgit/bgit_init
|
||||
b_init "$@"
|
||||
fi
|
||||
|
||||
elif [[ $numrepos -ge 1 && $numargs -eq 1 && $1 == "-r" || $1 == "--revert" ]] ; then
|
||||
source $HOME/.config/bgit/bgit_revert
|
||||
b_revert "$@"
|
||||
|
||||
elif [[ $numargs -eq 1 && $1 == "-h" || $1 == "--help" ]] ; then
|
||||
source $HOME/.config/bgit/bgit_help
|
||||
b_help "$@"
|
||||
elif [[ $numrepos -eq 0 && $numargs -eq 0 ]]; then
|
||||
echo "${txtgreen} no git repository found, executing git init...${txtwhite}"
|
||||
source $HOME/.config/bgit/bgit_init
|
||||
b_init "$@"
|
||||
fi
|
||||
|
||||
while getopts "irh" opt ; do
|
||||
case $opt in
|
||||
i)
|
||||
echo "${txtgreen} no git repository found, executing git init...${txtwhite}"
|
||||
source $HOME/.config/bgit/bgit_init
|
||||
b_init "$@"
|
||||
;;
|
||||
r)
|
||||
source $HOME/.config/bgit/bgit_revert
|
||||
b_revert "$@"
|
||||
;;
|
||||
h)
|
||||
source $HOME/.config/bgit/bgit_help
|
||||
b_help "$@"
|
||||
;;
|
||||
*)
|
||||
echo "${txtred}✗ flag not recognized...${txtwhite}"
|
||||
echo "${txtred}✗ bgit exiting...${txtwhite}"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
# elif [[ $numrepos -eq 0 || $numargs -eq 1 && $1 == "-i" || $numargs -eq 1 && $1 == "--init" ]] ; then
|
||||
# if [[ $numrepos -eq 0 ]] ; then
|
||||
# echo "${txtgreen} no git repository found, executing git init...${txtwhite}"
|
||||
# source $HOME/.config/bgit/bgit_init
|
||||
# b_init "$@"
|
||||
# else
|
||||
# echo "${txtred} git repository already here..."
|
||||
# source $HOME/.config/bgit/bgit_init
|
||||
# b_init "$@"
|
||||
# fi
|
||||
|
||||
# elif [[ $numrepos -ge 1 && $numargs -eq 1 && $1 == "-r" || $numargs -eq 1 && $1 == "--revert" ]] ; then
|
||||
# source $HOME/.config/bgit/bgit_revert
|
||||
# b_revert "$@"
|
||||
|
||||
# elif [[ $numargs -eq 1 && $1 == "-h" || $numargs -eq 1 && $1 == "--help" ]] ; then
|
||||
# source $HOME/.config/bgit/bgit_help
|
||||
# b_help "$@"
|
||||
}
|
||||
|
||||
bgit "$@"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue