Skip to content

Commit

Permalink
🔨🔨🔨 Improve code style 🔨🔨🔨
Browse files Browse the repository at this point in the history
  • Loading branch information
diogocavilha committed Dec 6, 2018
1 parent 505b65c commit 1309c14
Show file tree
Hide file tree
Showing 36 changed files with 193 additions and 132 deletions.
8 changes: 3 additions & 5 deletions alias_functions/ga.sh
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
#!/bin/bash
#
# Author: Diogo Alexsander Cavilha <[email protected]>
# Date: 03.13.2017
# Author: Diogo Alexsander Cavilha <[email protected]>
# Date: 03.13.2017
#
# ADDING FILES
#
# Adds files in order to commit and shows git status
# git add

git add $* && \
clear && \
Expand Down
8 changes: 3 additions & 5 deletions alias_functions/gaa.sh
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
#!/bin/bash
#
# Author: Diogo Alexsander Cavilha <[email protected]>
# Date: 03.13.2017
# Author: Diogo Alexsander Cavilha <[email protected]>
# Date: 03.13.2017
#
# ADDING ALL FILES
#
# Adds all files in order to commit and shows git status
# git add --all

git add --all && \
clear && \
Expand Down
8 changes: 3 additions & 5 deletions alias_functions/gck.sh
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
#!/bin/bash
#
# Author: Diogo Alexsander Cavilha <[email protected]>
# Date: 03.16.2017
# Author: Diogo Alexsander Cavilha <[email protected]>
# Date: 03.16.2017
#
# CHECKOUT FILES
#
# Checkout files and shows git status
# git checkout --

git checkout -- $* && \
clear && \
Expand Down
10 changes: 4 additions & 6 deletions alias_functions/gckbt.sh
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
#!/bin/bash
#
# Author: Diogo Alexsander Cavilha <[email protected]>
# Date: 07.05.2016
# Author: Diogo Alexsander Cavilha <[email protected]>
# Date: 07.05.2016
#
# BRANCH CHACKOUT
#
# It forces the checkout of a branch
# git checkout --track origin/<current_branch_name>

branch_name=$1
branch_name="$1"
git checkout --track origin/$branch_name
14 changes: 5 additions & 9 deletions alias_functions/gd.sh
Original file line number Diff line number Diff line change
@@ -1,16 +1,13 @@
#!/bin/bash
#
# Author: Diogo Alexsander Cavilha <[email protected]>
# Date: 11.28.2017
# Author: Diogo Alexsander Cavilha <[email protected]>
# Date: 11.28.2017
#
# GIT DIFF
#
# Show changes of a file and suggests to add it
# git diff

clear

if [ "$1" = "" ]
then
if [ "$1" = "" ]; then
git diff
return
fi
Expand All @@ -20,8 +17,7 @@ git diff "$1"
echo ""
read -p " Add this file to commit? [y/N]: " r

if [ "$r" = "y" ]
then
if [ "$r" = "y" ]; then
git add "$1"
fi

Expand Down
18 changes: 9 additions & 9 deletions alias_functions/gg.sh
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
#!/bin/bash
#
# Author: Diogo Alexsander Cavilha <[email protected]>
# Date: 04.21.2018
# Author: Diogo Alexsander Cavilha <[email protected]>
# Date: 04.21.2018
#
# ADD, COMMIT, PUSH
#
# A shortcut for a common sequence in order to push changes
# git add --all
# git commit -m <message>
# git push origin <current_branch_name>

branch=$(git branch | grep -oP '(?<=\* ).*')
msg=$1
branch_name=$(git branch | grep -oP '(?<=\* ).*')
msg="$1"

git add --all && \
git commit -m "$1" && \
git push origin $branch
git commit -m "$msg" && \
git push origin $branch_name
8 changes: 3 additions & 5 deletions alias_functions/glp.sh
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
#!/bin/bash
#
# Author: Diogo Alexsander Cavilha <[email protected]>
# Date: 09.01.2016
# Author: Diogo Alexsander Cavilha <[email protected]>
# Date: 09.01.2016
#
# GIT LOG
#
# Perform a pretty git log
# It performs a pretty git log.

logCmd="git log --date=short --pretty=format:'%C(bold yellow)%h%C(reset) %C(white)%ad %C(bold blue)(%ar)%C(reset) %C(bold green)%an %C(reset)%C(cyan)%s%C(reset)'"

Expand Down
5 changes: 5 additions & 0 deletions alias_functions/gpl.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
#!/bin/bash
#
# Author: Diogo Alexsander Cavilha <[email protected]>
# Date: 04.01.2016
#
# git pull

. ~/.fancy-git/random_messages.sh

Expand Down
11 changes: 8 additions & 3 deletions alias_functions/gplo.sh
Original file line number Diff line number Diff line change
@@ -1,12 +1,17 @@
#!/bin/bash
#
# Author: Diogo Alexsander Cavilha <[email protected]>
# Date: 04.01.2016
#
# git pull origin <branch_name>

. ~/.fancy-git/random_messages.sh

run() {
local branch
branch="$1"
local branch_name
branch_name="$1"

git pull origin $branch
git pull origin $branch_name

_fancygit_after_pulling_random_message
}
11 changes: 8 additions & 3 deletions alias_functions/gplob.sh
Original file line number Diff line number Diff line change
@@ -1,12 +1,17 @@
#!/bin/bash
#
# Author: Diogo Alexsander Cavilha <[email protected]>
# Date: 04.01.2016
#
# git pull origin <current_branch_name>

. ~/.fancy-git/random_messages.sh

run() {
local branch
branch=$(git branch | grep -oP '(?<=\* ).*')
local branch_name
branch_name=$(git branch | grep -oP '(?<=\* ).*')

git pull origin $branch
git pull origin $branch_name

_fancygit_after_pulling_random_message
}
9 changes: 7 additions & 2 deletions alias_functions/gpsob.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
#!/bin/bash
#
# Author: Diogo Alexsander Cavilha <[email protected]>
# Date: 04.01.2016
#
# git push origin <current_branch_name>

branch=$(git branch | grep -oP '(?<=\* ).*')
branch_name=$(git branch | grep -oP '(?<=\* ).*')

git push origin $branch
git push origin $branch_name
10 changes: 5 additions & 5 deletions alias_functions/grb.sh
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
#!/bin/bash
#
# Author: Diogo Alexsander Cavilha <[email protected]>
# Date: 05.24.2016
# Author: Diogo Alexsander Cavilha <[email protected]>
# Date: 05.24.2016
#
# BRANCH RENAMING
# It renames a branch locally.
#
# Rename branch locally
# git branch -m <new_branch_name>

new_branch_name=$1
new_branch_name="$1"

git branch -m $new_branch_name
16 changes: 9 additions & 7 deletions alias_functions/grba.sh
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
#!/bin/bash
#
# Author: Diogo Alexsander Cavilha <[email protected]>
# Date: 05.24.2016
# Author: Diogo Alexsander Cavilha <[email protected]>
# Date: 05.24.2016
#
# BRANCH RENAMING
# Rename branch locally.
# Delete the old branch.
# Push the new branch, set local branch to track the new remote branch.
#
# Rename branch locally
# Delete the old branch
# Push the new branch, set local branch to track the new remote
# git branch -m <new_branch_name>
# git push origin :<old_branch_name>
# git push origin <new_branch_name>

new_branch_name=$1
new_branch_name="$1"
old_branch_name=$(git branch | grep -oP '(?<=\* ).*')

git branch -m $new_branch_name
Expand Down
10 changes: 4 additions & 6 deletions alias_functions/gsta.sh
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
#!/bin/bash
#
# Author: Diogo Alexsander Cavilha <[email protected]>
# Date: 04.19.2018
# Author: Diogo Alexsander Cavilha <[email protected]>
# Date: 04.19.2018
#
# APPLY STASH
#
# It applies a stash
# git stash apply stash@{<stash_id>}

stash_id=$1
stash_id="$1"
git stash apply stash@{$stash_id}
10 changes: 4 additions & 6 deletions alias_functions/gstd.sh
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
#!/bin/bash
#
# Author: Diogo Alexsander Cavilha <[email protected]>
# Date: 04.19.2018
# Author: Diogo Alexsander Cavilha <[email protected]>
# Date: 04.19.2018
#
# DROP STASH
#
# It drops a stash
# git stash drop stash@{<stash_id>}

stash_id=$1
stash_id="$1"
git stash drop stash@{$stash_id}
10 changes: 4 additions & 6 deletions alias_functions/gstw.sh
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
#!/bin/bash
#
# Author: Diogo Alexsander Cavilha <[email protected]>
# Date: 04.19.2018
# Author: Diogo Alexsander Cavilha <[email protected]>
# Date: 04.19.2018
#
# SHOW STASH CHANGES
#
# It shows a stash changes
# git stash show stash@{<stash_id>}

stash_id=$1
stash_id="$1"
git stash show stash@{$stash_id}
9 changes: 6 additions & 3 deletions alias_functions/gurl.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
#!/bin/bash

gurl=$(git config --list | grep -oE 'https://.*|git@.*')
#
# Author: Diogo Alexsander Cavilha <[email protected]>
# Date: 03.04.2016
#
# git remote -v

echo ""
echo " $gurl"
git remote -v
echo ""
5 changes: 5 additions & 0 deletions alias_functions/guser.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
#!/bin/bash
#
# Author: Diogo Alexsander Cavilha <[email protected]>
# Date: 03.18.2016
#
# It shows the user name and email.

guser=$(git config --list | grep -oP '(?<=user.name=).*')
gemail=$(git config --list | grep -oP '(?<=user.email=).*')
Expand Down
28 changes: 13 additions & 15 deletions commands.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
#!/bin/bash
#
# Author: Diogo Alexsander Cavilha <[email protected]>
# Date: 03.02.2016
#
# Commands manager.

. ~/.fancy-git/version.sh

Expand All @@ -19,8 +24,7 @@ fg_update() {

current_date=$(date +%Y-%m-%d)

if [ ! -f ~/.fancy-git/last_update_at ]
then
if [ ! -f ~/.fancy-git/last_update_at ]; then
touch -f ~/.fancy-git/last_update_at
fi

Expand Down Expand Up @@ -69,25 +73,21 @@ fg_update_checker() {
current_date=$(date +%Y-%m-%d)
last_update_at=$(cat ~/.fancy-git/last_update_at)

if [ ! -f ~/.fancy-git/last_update_at ]
then
if [ ! -f ~/.fancy-git/last_update_at ]; then
touch -f ~/.fancy-git/last_update_at
fi

if [ "$manual_update" = "yes" ]
then
if [ "$manual_update" = "yes" ]; then
fg_update
return
fi

if [ "$current_date" = "$last_update_at" ]
then
if [ "$current_date" = "$last_update_at" ]; then
return
fi

branch_name=$(git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/\1/')
if [ "$branch_name" = "" ]
then
if [ "$branch_name" = "" ]; then
return
fi

Expand All @@ -97,15 +97,13 @@ fg_update_checker() {
updates=$(cd ~/.fancy-git && git diff origin/master)
option="n"

if [ "$updates" != "" ]
then
if [ "$updates" != "" ]; then
echo ""
echo " Hey! A new Fancy Git update has been released!"
read -p " Would you like to update it? [Y/n]: " option
fi

if [ "$option" = "y" ]
then
if [ "$option" = "y" ]; then
echo ""
fg_update
fi
Expand All @@ -114,7 +112,7 @@ fg_update_checker() {
cd "$current_dir" || return
}

case $1 in
case "$1" in
"-h"|"--help") fg_script_help;;
"-v"|"--version") fg_show_version;;
"update") fg_update_checker;;
Expand Down
7 changes: 7 additions & 0 deletions config → config.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
#!/bin/bash
#
# Author: Diogo Alexsander Cavilha <[email protected]>
# Date: 06.06.2018
#
# Configuration file.

# ASCII
local separator
local branch_icon
Expand Down
Loading

0 comments on commit 1309c14

Please sign in to comment.