✨ Lots of new features in scripts and gitmojis
This commit is contained in:
parent
fea727cd52
commit
b2dc0c5d54
6 changed files with 632 additions and 4 deletions
|
|
@ -81,3 +81,9 @@ artix/atlassin(for use in bash/prompt) ﴂ
|
||||||
cancel/deleted/x ✗
|
cancel/deleted/x ✗
|
||||||
check-mark ✓
|
check-mark ✓
|
||||||
right-arrow ➜
|
right-arrow ➜
|
||||||
|
npm
|
||||||
|
github
|
||||||
|
gitlab
|
||||||
|
git
|
||||||
|
email
|
||||||
|
person
|
||||||
|
|
|
||||||
|
|
@ -39,7 +39,7 @@ tput bold & tput setaf 7
|
||||||
numrepos=$(git remote | wc -l)
|
numrepos=$(git remote | wc -l)
|
||||||
|
|
||||||
# If there are no git repositories in this directory...
|
# If there are no git repositories in this directory...
|
||||||
if [ $numrepos -eq 0 ] ; then
|
if [[ $numrepos -eq 0 ]] ; then
|
||||||
echo "${txtgreen}no git repository found, executing git init...${txtwhite}"
|
echo "${txtgreen}no git repository found, executing git init...${txtwhite}"
|
||||||
while true
|
while true
|
||||||
do
|
do
|
||||||
|
|
@ -327,13 +327,13 @@ else
|
||||||
|
|
||||||
# Let the user know what is staged for commit
|
# Let the user know what is staged for commit
|
||||||
if [[ $newfiles ]]; then
|
if [[ $newfiles ]]; then
|
||||||
echo "${txtgreen} ADDED: ${txtgreen}$newfiles"
|
echo "${txtgreen} ADDED: ${txtgreen}$newfiles"
|
||||||
fi
|
fi
|
||||||
if [[ $modified ]]; then
|
if [[ $modified ]]; then
|
||||||
echo "${txtblue}פֿ MODIFIED: ${txtblue}$modified"
|
echo "${txtblue} פֿ MODIFIED: ${txtblue}$modified"
|
||||||
fi
|
fi
|
||||||
if [[ $deleted ]]; then
|
if [[ $deleted ]]; then
|
||||||
echo "${txtred} DELETED: ${txtred}$deleted"
|
echo "${txtred} ✗ DELETED: ${txtred}$deleted"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
while true
|
while true
|
||||||
|
|
|
||||||
226
scripts/bgit_echomoji
Executable file
226
scripts/bgit_echomoji
Executable file
|
|
@ -0,0 +1,226 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# Error handling
|
||||||
|
set -e
|
||||||
|
|
||||||
|
function echomoji() {
|
||||||
|
gitmoji=$1
|
||||||
|
case $gitmoji in
|
||||||
|
":art:")
|
||||||
|
echo "${txtblue} $cmessage${txtwhite}"
|
||||||
|
;;
|
||||||
|
":zap:")
|
||||||
|
echo "${txtblue}⚡️$cmessage${txtwhite}"
|
||||||
|
;;
|
||||||
|
":fire:")
|
||||||
|
echo "${txtblue} $cmessage${txtwhite}"
|
||||||
|
;;
|
||||||
|
":bug:")
|
||||||
|
echo "${txtblue}ﴫ $cmessage${txtwhite}"
|
||||||
|
;;
|
||||||
|
":ambulance:")
|
||||||
|
echo "${txtblue}🚑️ $cmessage${txtwhite}"
|
||||||
|
;;
|
||||||
|
":sparkles:")
|
||||||
|
echo "${txtblue} $cmessage${txtwhite}"
|
||||||
|
;;
|
||||||
|
":memo:")
|
||||||
|
echo "${txtblue} $cmessage${txtwhite}"
|
||||||
|
;;
|
||||||
|
":rocket:")
|
||||||
|
echo "${txtblue}異 $cmessage${txtwhite}"
|
||||||
|
;;
|
||||||
|
":lipstick:")
|
||||||
|
echo "${txtblue} $cmessage${txtwhite}"
|
||||||
|
;;
|
||||||
|
":tada:")
|
||||||
|
echo "${txtblue} $cmessage${txtwhite}"
|
||||||
|
;;
|
||||||
|
":white_check_mark:")
|
||||||
|
echo "${txtblue} $cmessage${txtwhite}"
|
||||||
|
;;
|
||||||
|
":lock:")
|
||||||
|
echo "${txtblue}🔒️ $cmessage${txtwhite}"
|
||||||
|
;;
|
||||||
|
":closed_lock_with_key:")
|
||||||
|
echo "${txtblue} $cmessage${txtwhite}"
|
||||||
|
;;
|
||||||
|
":bookmark:")
|
||||||
|
echo "${txtblue} $cmessage${txtwhite}"
|
||||||
|
;;
|
||||||
|
":rotating_light:")
|
||||||
|
echo "${txtblue}ﲍ $cmessage${txtwhite}"
|
||||||
|
;;
|
||||||
|
":construction:")
|
||||||
|
echo "${txtblue} $cmessage${txtwhite}"
|
||||||
|
;;
|
||||||
|
":green_heart")
|
||||||
|
echo "${txtblue} $cmessage${txtwhite}"
|
||||||
|
;;
|
||||||
|
":arrow_down:")
|
||||||
|
echo "${txtblue}ﰬ $cmessage${txtwhite}"
|
||||||
|
;;
|
||||||
|
":arrow_up:")
|
||||||
|
echo "${txtblue}ﰵ $cmessage${txtwhite}"
|
||||||
|
;;
|
||||||
|
":pushpin:")
|
||||||
|
echo "${txtblue} $cmessage${txtwhite}"
|
||||||
|
;;
|
||||||
|
":construction_worker:")
|
||||||
|
echo "${txtblue}華 $cmessage${txtwhite}"
|
||||||
|
;;
|
||||||
|
":chart_with_upwards_trend:")
|
||||||
|
echo "${txtblue} $cmessage${txtwhite}"
|
||||||
|
;;
|
||||||
|
":recycle:")
|
||||||
|
echo "${txtblue}屢 $cmessage${txtwhite}"
|
||||||
|
;;
|
||||||
|
":heavy_plus_sign:")
|
||||||
|
echo "${txtblue} $cmessage${txtwhite}"
|
||||||
|
;;
|
||||||
|
":heavy_minus_sign:")
|
||||||
|
echo "${txtblue} $cmessage${txtwhite}"
|
||||||
|
;;
|
||||||
|
":wrench:")
|
||||||
|
echo "${txtblue}襁 $cmessage${txtwhite}"
|
||||||
|
;;
|
||||||
|
":hammer:")
|
||||||
|
echo "${txtblue} $cmessage${txtwhite}"
|
||||||
|
;;
|
||||||
|
":globe_with_meridians:")
|
||||||
|
echo "${txtblue}🌐 $cmessage${txtwhite}"
|
||||||
|
;;
|
||||||
|
":pencil2:")
|
||||||
|
echo "${txtblue} $cmessage${txtwhite}"
|
||||||
|
;;
|
||||||
|
":poop:")
|
||||||
|
echo "${txtblue} $cmessage${txtwhite}"
|
||||||
|
;;
|
||||||
|
":rewind:")
|
||||||
|
echo "${txtblue}⏪️ $cmessage${txtwhite}"
|
||||||
|
;;
|
||||||
|
":twisted_rightwards_arrows:")
|
||||||
|
echo "${txtblue} $cmessage${txtwhite}"
|
||||||
|
;;
|
||||||
|
":package:")
|
||||||
|
echo "${txtblue} $cmessage${txtwhite}"
|
||||||
|
;;
|
||||||
|
":alien:")
|
||||||
|
echo "${txtblue} $cmessage${txtwhite}"
|
||||||
|
;;
|
||||||
|
":truck:")
|
||||||
|
echo "${txtblue} $cmessage${txtwhite}"
|
||||||
|
;;
|
||||||
|
":page_facing_up:")
|
||||||
|
echo "${txtblue} $cmessage${txtwhite}"
|
||||||
|
;;
|
||||||
|
":boom:")
|
||||||
|
echo "${txtblue} $cmessage${txtwhite}"
|
||||||
|
;;
|
||||||
|
":bento:")
|
||||||
|
echo "${txtblue}ﳨ $cmessage${txtwhite}"
|
||||||
|
;;
|
||||||
|
":wheelchair:")
|
||||||
|
echo "${txtblue} $cmessage${txtwhite}"
|
||||||
|
;;
|
||||||
|
":bulb:")
|
||||||
|
echo "${txtblue}ﯦ $cmessage${txtwhite}"
|
||||||
|
;;
|
||||||
|
":beers:")
|
||||||
|
echo "${txtblue} $cmessage${txtwhite}"
|
||||||
|
;;
|
||||||
|
":speech_balloon:")
|
||||||
|
echo "${txtblue} $cmessage${txtwhite}"
|
||||||
|
;;
|
||||||
|
":card_file_box:")
|
||||||
|
echo "${txtblue} $cmessage${txtwhite}"
|
||||||
|
;;
|
||||||
|
":loud_sound:")
|
||||||
|
echo "${txtblue} $cmessage${txtwhite}"
|
||||||
|
;;
|
||||||
|
":mute:")
|
||||||
|
echo "${txtblue}婢 $cmessage${txtwhite}"
|
||||||
|
;;
|
||||||
|
":busts_in_silhouette:")
|
||||||
|
echo "${txtblue} $cmessage${txtwhite}"
|
||||||
|
;;
|
||||||
|
":children_crossing:")
|
||||||
|
echo "${txtblue} $cmessage${txtwhite}"
|
||||||
|
;;
|
||||||
|
":building_construction:")
|
||||||
|
echo "${txtblue} $cmessage${txtwhite}"
|
||||||
|
;;
|
||||||
|
":iphone:")
|
||||||
|
echo "${txtblue} $cmessage${txtwhite}"
|
||||||
|
;;
|
||||||
|
":clown_face:")
|
||||||
|
echo "${txtblue} $cmessage${txtwhite}"
|
||||||
|
;;
|
||||||
|
":egg:")
|
||||||
|
echo "${txtblue} $cmessage${txtwhite}"
|
||||||
|
;;
|
||||||
|
":see_no_evil:")
|
||||||
|
echo "${txtblue} $cmessage${txtwhite}"
|
||||||
|
;;
|
||||||
|
":camera_flash:")
|
||||||
|
echo "${txtblue} $cmessage${txtwhite}"
|
||||||
|
;;
|
||||||
|
":alembic:")
|
||||||
|
echo "${txtblue} $cmessage${txtwhite}"
|
||||||
|
;;
|
||||||
|
":mag:")
|
||||||
|
echo "${txtblue} $cmessage${txtwhite}"
|
||||||
|
;;
|
||||||
|
":label:")
|
||||||
|
echo "${txtblue} $cmessage${txtwhite}"
|
||||||
|
;;
|
||||||
|
":seedling:")
|
||||||
|
echo "${txtblue} $cmessage${txtwhite}"
|
||||||
|
;;
|
||||||
|
":triangular_flag_on_post:")
|
||||||
|
echo "${txtblue} $cmessage${txtwhite}"
|
||||||
|
;;
|
||||||
|
":goal_net:")
|
||||||
|
echo "${txtblue} $cmessage${txtwhite}"
|
||||||
|
;;
|
||||||
|
":dizzy:")
|
||||||
|
echo "${txtblue}💫 $cmessage${txtwhite}"
|
||||||
|
;;
|
||||||
|
":wastebasket:")
|
||||||
|
echo "${txtblue} $cmessage${txtwhite}"
|
||||||
|
;;
|
||||||
|
":passport_control:")
|
||||||
|
echo "${txtblue} $cmessage${txtwhite}"
|
||||||
|
;;
|
||||||
|
":adhesive_bandages:")
|
||||||
|
echo "${txtblue}🩹 $cmessage${txtwhite}"
|
||||||
|
;;
|
||||||
|
":monocole_face:")
|
||||||
|
echo "${txtblue} $cmessage${txtwhite}"
|
||||||
|
;;
|
||||||
|
":coffin:")
|
||||||
|
echo "${txtblue}ﮊ $cmessage${txtwhite}"
|
||||||
|
;;
|
||||||
|
":test_tube:")
|
||||||
|
echo "${txtblue}ﭧ $cmessage${txtwhite}"
|
||||||
|
;;
|
||||||
|
":necktie:")
|
||||||
|
echo "${txtblue}礼 $cmessage${txtwhite}"
|
||||||
|
;;
|
||||||
|
":stethoscope:")
|
||||||
|
echo "${txtblue} $cmessage${txtwhite}"
|
||||||
|
;;
|
||||||
|
":bricks:")
|
||||||
|
echo "${txtblue} $cmessage${txtwhite}"
|
||||||
|
;;
|
||||||
|
":technologist:")
|
||||||
|
echo "${txtblue} $cmessage${txtwhite}"
|
||||||
|
;;
|
||||||
|
":money_with_wings:")
|
||||||
|
echo "${txtblue} $cmessage${txtwhite}"
|
||||||
|
;;
|
||||||
|
":thread:")
|
||||||
|
echo "${txtblue} $cmessage${txtwhite}"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
}
|
||||||
162
scripts/bgit_init
Normal file
162
scripts/bgit_init
Normal file
|
|
@ -0,0 +1,162 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
function b_init() {
|
||||||
|
while true
|
||||||
|
do
|
||||||
|
dependencycheck read
|
||||||
|
read -e -r -p "${txtwhite} initialize repository?(y/n): ${txtyellow}" init
|
||||||
|
if [[ $init == "n" || $init = "no" ]]; then
|
||||||
|
echo "${txtred}✗ no git repository initialized...exiting${txtwhite}"
|
||||||
|
break
|
||||||
|
elif [[ $init == "y" || $init == "yes" ]] ; then
|
||||||
|
|
||||||
|
if [ ! -f "README.md" ] ; then
|
||||||
|
echo -e "## A Simple README\n\nSome Text\n\n__Some Checklist__\n\n- [x] Completed task\n- [ ] Incomplete task" > README.md
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo -e "node_modules\n*.env\n*.out\n.pretterrc\n.gitignore" > .gitignore
|
||||||
|
git init
|
||||||
|
git config commit.gpgsign false
|
||||||
|
|
||||||
|
while true
|
||||||
|
do
|
||||||
|
read -e -r -p "${txtwhite} would you like to change username/password from global defaults?(y/n): ${txtyellow}" changedefaults
|
||||||
|
if [[ $changedefaults == "y" || $changedefaults == "yes" ]] ; then
|
||||||
|
read -e -r -p "${txtwhite} enter your username: ${txtyellow}" uname
|
||||||
|
if [[ -n $uname ]] ; then
|
||||||
|
git config user.name $uname
|
||||||
|
read -e -r -p "${txtwhite} enter your email: ${txtyellow}" uemail
|
||||||
|
if [[ -n $uemail ]] ; then
|
||||||
|
git config user.email $uemail
|
||||||
|
break
|
||||||
|
else
|
||||||
|
echo "${txtblue} no email entered, defaulting to global value${txtwhite}"
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
echo "${txtblue} no username entered, defaulting to global value${txtwhite}"
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
echo "${txtblue} defaulting to global username/password${txtwhite}" break
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
while true
|
||||||
|
do
|
||||||
|
read -e -r -p "${txtwhite} would you like to make this an npm project?(y/n): ${txtyellow}" confirmnpm
|
||||||
|
if [[ $confirmnpm == "y" || $confirmnpm == "yes" ]] ; then
|
||||||
|
tput bold & tput setaf 7
|
||||||
|
dependencycheck sed node npm prettier
|
||||||
|
|
||||||
|
npm init -y > /dev/null 2>&1
|
||||||
|
npm install -D nodemon prettier jest > /dev/null 2>&1
|
||||||
|
|
||||||
|
echo -e 'trailingComma: "all"\ntabWidth: 4\nsemi: false\nsingleQuote: true\nbracketSpacing: true\narrowParens: "avoid"' > .prettierrc
|
||||||
|
|
||||||
|
echo -e '<!DOCTYPE html>\n<html>\n <head>\n <meta charset="utf-8">\n <meta name="viewport" content="width=device-width">\n <title>My Website</title>\n <link rel="stylesheet" href="css/styles.css" />\n </head>\n <body>\n <h1>Header 1</h1>\n <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.</p>\n <script src="scripts/index.js" defer></script>\n </body>\n</html>' > index.html
|
||||||
|
|
||||||
|
mkdir scripts
|
||||||
|
mkdir css
|
||||||
|
mkdir tests
|
||||||
|
touch tests/index.test.js
|
||||||
|
|
||||||
|
echo 'console.log("Hello World!");' > scripts/index.js
|
||||||
|
echo -e '* {\n font-family: monospace;\n text-align: center;\n background-color: #dedede;\n}' > css/styles.css
|
||||||
|
|
||||||
|
dependencycheck sed
|
||||||
|
sed 's/1"/1",/' package.json > package2.json && sed -i '/no test/a\ \ \ \ "start":\ "nodemon\ scripts/index.js"' package2.json && mv package2.json package.json
|
||||||
|
break
|
||||||
|
else
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
tput bold & tput setaf 7
|
||||||
|
|
||||||
|
git add . >/dev/null 2>&1
|
||||||
|
git commit -m ":tada: Initial commit!" >/dev/null 2>&1
|
||||||
|
echo "${txtblue} Initial commit!${txtwhite}"
|
||||||
|
|
||||||
|
while true
|
||||||
|
do
|
||||||
|
read -e -r -p "${txtwhite} change branch name?(y/n): ${txtyellow}" chbranch
|
||||||
|
if [[ $chbranch == "y" || $chbranch == "yes" ]] ; then
|
||||||
|
read -e -r -p "${txtwhite} branch name?(i.e. 'main'): ${txtyellow}" branch
|
||||||
|
if [ -n "$branch" ] ; then
|
||||||
|
git branch -M $branch
|
||||||
|
break
|
||||||
|
else
|
||||||
|
echo "${txtred}✗ branch name is empty, please enter branch name!${txtwhite}"
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
echo "${txtblue} branch name will be left as ${txtyellow}'master'${txtwhite}"
|
||||||
|
branch="master"
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
while true
|
||||||
|
do
|
||||||
|
uname=$(git config user.name)
|
||||||
|
read -e -r -p "${txtwhite} Please enter remote to add(i.e. origin): ${txtyellow}" remote
|
||||||
|
|
||||||
|
if [[ -z $remote ]]; then
|
||||||
|
remote="origin"
|
||||||
|
fi
|
||||||
|
|
||||||
|
while [ -z $host ]
|
||||||
|
do
|
||||||
|
read -e -r -p "${txtwhite} Please enter host site (i.e. github.com): ${txtyellow}" host
|
||||||
|
done
|
||||||
|
|
||||||
|
while [ -z $repo ]
|
||||||
|
do
|
||||||
|
read -e -r -p "${txtwhite} Please enter name of repository: ${txtyellow}" repo
|
||||||
|
done
|
||||||
|
|
||||||
|
tput bold & tput setaf 7
|
||||||
|
|
||||||
|
if [[ -n $host && $host == "github.com" ]] ; then
|
||||||
|
read -e -r -p "${txtwhite} Host site is github.com, would you like bgit to create the repository?(y/n): ${txtyellow}" crepo
|
||||||
|
|
||||||
|
tput bold & tput setaf 7
|
||||||
|
|
||||||
|
if [[ ! -f $HOME/.gh_pat ]]; then
|
||||||
|
echo "${txtred} Github personal access token doesn't exist"
|
||||||
|
echo " See https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/creating-a-personal-access-token${txtwhite}"
|
||||||
|
exit 1
|
||||||
|
else
|
||||||
|
source $HOME/.gh_pat
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ $crepo == 'y' || $crepo == 'yes' ]] ; then
|
||||||
|
dependencycheck curl
|
||||||
|
echo "${txtgreen} Host Site is github.com, creating repository...${txtwhite}"
|
||||||
|
curl -u $uname:$GH_TOKEN https://api.github.com/user/repos -d '{"name": "'${repo}'"}'
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo -e "${txtblue} Your \$GH_TOKEN is saved to your clipboard...\nsimply enter CTRL+SHIFT+V to paste your token...\nwhen prompted for your password${txtwhite}"
|
||||||
|
dependencycheck xclip
|
||||||
|
echo $GH_TOKEN | xclip -sel clip
|
||||||
|
fi
|
||||||
|
|
||||||
|
git remote add $remote "https://$host/$uname/$repo"
|
||||||
|
git push --set-upstream $remote $branch
|
||||||
|
|
||||||
|
if [[ $host == "github.com" ]] ; then
|
||||||
|
echo "${txtgreen} Github repository created and initiated!!${txtwhite}"
|
||||||
|
echo '' | xclip && xclip -selection clipboard /dev/null
|
||||||
|
exit 0
|
||||||
|
else
|
||||||
|
echo "${txtgreen} Git repository initiated!!${txtwhite}"
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
break
|
||||||
|
done
|
||||||
|
else
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
}
|
||||||
159
scripts/bgit_v2
Executable file
159
scripts/bgit_v2
Executable file
|
|
@ -0,0 +1,159 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# so far requires gitmojis (txt file) and also
|
||||||
|
# bgit_gitmoji for function echomoji that displays gitmojis in terminal
|
||||||
|
|
||||||
|
# Error handling
|
||||||
|
set -e
|
||||||
|
# For styling/colorizing output
|
||||||
|
txtbld=$(tput bold)
|
||||||
|
txtblue=${txtbld}$(tput setaf 4)
|
||||||
|
txtgreen=${txtbld}$(tput setaf 2)
|
||||||
|
txtred=${txtbld}$(tput setaf 1)
|
||||||
|
txtyellow=${txtbld}$(tput setaf 3)
|
||||||
|
txtwhite=${txtbld}$(tput setaf 7)
|
||||||
|
|
||||||
|
# Dependency check
|
||||||
|
function dependencycheck() {
|
||||||
|
numdependencies="$#"
|
||||||
|
dependencies=("$@")
|
||||||
|
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}✗ Please install needed dependencies${txtwhite}"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
dependencycheck git
|
||||||
|
|
||||||
|
tput bold & tput setaf 7
|
||||||
|
|
||||||
|
function bgit() {
|
||||||
|
numrepos=$(git remote | wc -l)
|
||||||
|
numargs="$#"
|
||||||
|
# args=("$@")
|
||||||
|
|
||||||
|
if [[ $numrepos -ge 1 && $numargs -eq 0 ]]; then
|
||||||
|
dependencycheck grep awk tr
|
||||||
|
|
||||||
|
remotearray=($(git remote))
|
||||||
|
newfiles=$(git status --short | grep '??' | awk '{print $2}' | tr '\n' ' ')
|
||||||
|
modified=$(git status | grep modified | awk '{print $2}' | tr '\n' ' ')
|
||||||
|
deleted=$(git status | grep deleted | awk '{print $2}' | tr '\n' ' ')
|
||||||
|
|
||||||
|
if [[ -n $newfiles || -n $modified || -n $deleted ]] ; then
|
||||||
|
echo "${txtwhite} The following files are staged for commit:"
|
||||||
|
else
|
||||||
|
echo "${txtgreen}✓ everything up-to-date...exiting bgit${txtwhite}"
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ $newfiles ]]; then
|
||||||
|
echo "${txtgreen} ADDED: ${txtgreen}$newfiles"
|
||||||
|
fi
|
||||||
|
if [[ $modified ]]; then
|
||||||
|
echo "${txtblue}פֿ MODIFIED: ${txtblue}$modified"
|
||||||
|
fi
|
||||||
|
if [[ $deleted ]]; then
|
||||||
|
echo "${txtred}✗ DELETED: ${txtred}$deleted"
|
||||||
|
fi
|
||||||
|
|
||||||
|
while true
|
||||||
|
do
|
||||||
|
dependencycheck read
|
||||||
|
read -e -r -p "${txtwhite} commit changes?(y/n): ${txtyellow}" change
|
||||||
|
if [[ $change == "y" || $change == "yes" ]] ; then
|
||||||
|
|
||||||
|
while true
|
||||||
|
do
|
||||||
|
read -e -r -p "${txtwhite} add a gitmoji?(y/n/help): ${txtyellow}" gmojiprompt
|
||||||
|
if [[ $gmojiprompt == "y" || $gmojiprompt == "yes" ]] ; then
|
||||||
|
read -e -r -p "${txtwhite} enter gitmoji: ${txtyellow}" gitmoji
|
||||||
|
gitmoji=":$gitmoji:"
|
||||||
|
break
|
||||||
|
elif [[ $gmojiprompt == "help" || $gmojiprompt == "h" ]] ; then
|
||||||
|
if command -v "bat" &> /dev/null ; then
|
||||||
|
bat ~/scripts/gitmojis
|
||||||
|
else
|
||||||
|
dependencycheck less
|
||||||
|
less ~/scripts/gitmojis
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
echo "${txtblue} no gitmoji specified...${txtwhite}"
|
||||||
|
gitmoji=""
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
while true
|
||||||
|
do
|
||||||
|
read -e -r -p "${txtwhite} commit message: ${txtyellow}" message
|
||||||
|
cmessage=("$message")
|
||||||
|
cmessage="$(tr '[:lower:]' '[:upper:]' <<< ${cmessage:0:1})${cmessage:1}"
|
||||||
|
if [ "${#message}" -ge 51 ] ; then
|
||||||
|
echo "${txtred}✗ commit message is too large!"
|
||||||
|
echo "${txtred}✗ please limit to 50 or less characters${txtwhite}"
|
||||||
|
elif [ -n "$message" ] ; then
|
||||||
|
break
|
||||||
|
else
|
||||||
|
echo "${txtred}✗ commit message is empty, please write a commit message"
|
||||||
|
echo "${txtred}✗ or type 'CTRL+C' to quit${txtwhite}"
|
||||||
|
fi done
|
||||||
|
|
||||||
|
tput bold & tput setaf 7
|
||||||
|
|
||||||
|
if [[ $newfiles || $modified ]] ; then
|
||||||
|
git config credential.helper 'cache --timeout=3600';
|
||||||
|
git config advice.addEmptyPathspec false;
|
||||||
|
git add $modified $newfiles > /dev/null 2>&1
|
||||||
|
fi
|
||||||
|
|
||||||
|
git commit -m "$gitmoji $cmessage" > /dev/null 2>&1;
|
||||||
|
if [[ "$gitmoji" != "" ]] ; then
|
||||||
|
source ~/scripts/bgit_echomoji
|
||||||
|
echomoji $gitmoji
|
||||||
|
else
|
||||||
|
echo "${txtblue}$cmessage${txtwhite}"
|
||||||
|
fi
|
||||||
|
for ((i = 0; i < numrepos; i++)) ; do
|
||||||
|
git push --force ${remotearray[i]} > /dev/null 2>&1;
|
||||||
|
done
|
||||||
|
exit 0
|
||||||
|
|
||||||
|
elif [[ $change == "n" || $change == "no" ]] ; then
|
||||||
|
tput bold & tput setaf 7
|
||||||
|
|
||||||
|
git status --short
|
||||||
|
echo "${txtred}✗ no changes committed"
|
||||||
|
exit 0
|
||||||
|
|
||||||
|
elif [[ $change == "q" || $change == "quit" ]] ; then
|
||||||
|
exit 0
|
||||||
|
|
||||||
|
else
|
||||||
|
echo "${txtred}✗ please enter y or n or type 'q' or 'quit' or 'CTRL+C' to quit${txtwhite}"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
elif [[ $numrepos -eq 0 || $numargs -ge 1 && $1 == "-i" ]] ; then
|
||||||
|
if [[ $numrepos -eq 0 ]] ; then
|
||||||
|
echo "${txtgreen} no git repository found, executing git init...${txtwhite}"
|
||||||
|
source ~/scripts/bgit_init
|
||||||
|
b_init "$@"
|
||||||
|
else
|
||||||
|
echo "${txtred} git repository already here..."
|
||||||
|
source ~/scripts/bgit_init
|
||||||
|
b_init "$@"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
bgit "$@"
|
||||||
75
scripts/gitmojis
Normal file
75
scripts/gitmojis
Normal file
|
|
@ -0,0 +1,75 @@
|
||||||
|
A full list can be found at:
|
||||||
|
https://gitmoji.dev/
|
||||||
|
|
||||||
|
:art: ............................. improve structure/format code ...................................
|
||||||
|
:zap: ............................. improve performance ............................................. ⚡️
|
||||||
|
:fire: ............................ remove code or files ............................................ 🔥
|
||||||
|
:bug: ............................. fix a bug ....................................................... ﴫ
|
||||||
|
:ambulance: ....................... critical hotfix ................................................. 🚑️ .
|
||||||
|
:sparkles: ........................ introduce new features ..........................................
|
||||||
|
:memo: ............................ add or update documentation .....................................
|
||||||
|
:rocket: .......................... deploy stuff .................................................... 異
|
||||||
|
:lipstick: ........................ add or update the ui and style files ............................
|
||||||
|
:tada: ............................ begin a project .................................................
|
||||||
|
:white_check_mark: ................ add, update, or pass tests ......................................
|
||||||
|
:lock: ............................ fix security issues ............................................. 🔒️ .
|
||||||
|
:closed_lock_with_key: ............ add or update secrets ...........................................
|
||||||
|
:bookmark: ........................ release/version tags ............................................
|
||||||
|
:rotating_light: .................. fix compiler/linter warnings .................................... ﲍ
|
||||||
|
:construction: .................... work in progress ................................................
|
||||||
|
:green_heart: ..................... fix ci build ....................................................
|
||||||
|
:arrow_down: ...................... downgrade dependencies .......................................... ﰬ
|
||||||
|
:arrow_up: ........................ upgrade dependencies ............................................ ﰵ
|
||||||
|
:pushpin: ......................... pin dependencies to specific versions ...........................
|
||||||
|
:construction_worker: ............. add or udpate CI build system ................................... 華
|
||||||
|
:chart_with_upwards_trend: ........ add or update analytics or track code ...........................
|
||||||
|
:recycle: ......................... refactor code ................................................... 屢
|
||||||
|
:heavy_plus_sign: ................. add a dependency ................................................
|
||||||
|
:heavy_minus_sign: ................ remove a dependency .............................................
|
||||||
|
:wrench: .......................... add or update configuration files ............................... 襁
|
||||||
|
:hammer: .......................... add or update developement scripts ..............................
|
||||||
|
:globe_with_meridians: ............ internationalization and localization ........................... 🌐
|
||||||
|
:pencil2: ......................... fix typos .......................................................
|
||||||
|
:poop: ............................ write bad code that needs to be improved ........................
|
||||||
|
:rewind: .......................... revert changes .................................................. ⏪️ .
|
||||||
|
:twisted_rightwards_arrows ........ merge branches .................................................. נּ
|
||||||
|
:package: ......................... add or update compiled files or packages ........................
|
||||||
|
:alien: ........................... update code due to external api changes .........................
|
||||||
|
:truck: ........................... move or rename resources (e.g. files, paths, routes) ............
|
||||||
|
:page_facing_up: .................. add or update license ...........................................
|
||||||
|
:boom: ............................ introduce breaking changes ......................................
|
||||||
|
:bento: ........................... add or udpate assets ............................................ ﳨ
|
||||||
|
:wheelchair: ...................... improve accessibility............................................
|
||||||
|
:bulb: ............................ add or update comments in source code ........................... ﯦ
|
||||||
|
:beers: ........................... write code drunkenly ............................................
|
||||||
|
:speech_balloon: .................. add or udpate text and literals .................................
|
||||||
|
:card_file_box: ................... perform database related changes ................................
|
||||||
|
:loud_sound: ...................... add or update logs ..............................................
|
||||||
|
:mute: ............................ remove logs ..................................................... 婢
|
||||||
|
:busts_in_silhouette: ............. add or update contributor(s) ....................................
|
||||||
|
:children_crossing: ............... improve user experience/usability ...............................
|
||||||
|
:building_construction: ........... make architectural changes.......................................
|
||||||
|
:iphone: .......................... work on responsive design .......................................
|
||||||
|
:clown_face: ...................... mock things .....................................................
|
||||||
|
:egg: ............................. add or update easter egg ........................................
|
||||||
|
:see_no_evil: ..................... add or update a .gitignore file .................................
|
||||||
|
:camera_flash: .................... add or update snapshots .........................................
|
||||||
|
:alembic: ......................... perform experiments .............................................
|
||||||
|
:mag: ............................. improve SEO .....................................................
|
||||||
|
:label: ........................... add or udpate types .............................................
|
||||||
|
:seedling: ........................ add or update seed files ........................................
|
||||||
|
:triangular_flag_on_post: ......... add, update, or remove feature flags ............................
|
||||||
|
:goal_net: ........................ catch errors ....................................................
|
||||||
|
:dizzy: ........................... add or update animations and transitions ........................ 💫 .
|
||||||
|
:wastebasket: ..................... deprecate code that needs to be cleaned update ..................
|
||||||
|
:passport_control: ................ work on code related to authorization, roles, and permissions ...
|
||||||
|
:adhesive_bandages: ............... simple fix for a non-critical issue ............................. 🩹
|
||||||
|
:monocole_face: ................... data exploration/inspection .....................................
|
||||||
|
:coffin: .......................... remove dead code ................................................ ﮊ
|
||||||
|
:test_tube: ....................... add a failing test .............................................. ﭧ
|
||||||
|
:necktie: ......................... add or update business logic .................................... 礼
|
||||||
|
:stethoscope: ..................... add or update healthcheck .......................................
|
||||||
|
:bricks: .......................... infrastructure related changes ..................................
|
||||||
|
:technologist: .................... improve developer experience ....................................
|
||||||
|
:money_with_wings: ................ add sponsorships or money related infrastructure ................
|
||||||
|
:thread: .......................... add or update code related to multithreading or concurrency......
|
||||||
Loading…
Add table
Add a link
Reference in a new issue