1
0
mirror of https://gitlab.com/JKANetwork/jka-toolkit.git synced 2026-02-14 09:01:31 +01:00

Ident file and grammar fix

This commit is contained in:
Kevin Puertas
2017-02-28 20:46:47 +01:00
parent 7fdafa89e7
commit 4dfb7ac4db

View File

@@ -13,8 +13,8 @@ else #Else, all other options
actual2=$(git branch --list | grep "^*" | cut -f2 -d" ") #Current branch name actual2=$(git branch --list | grep "^*" | cut -f2 -d" ") #Current branch name
fi fi
if [ ! -z $gitopt ];then #No canceled if [ ! -z $gitopt ];then #No canceled
case $gitopt in case $gitopt in
#Not staying in a git repo #Options not in a git repo
"i") "i")
gitdir=`dialog --stdout --inputbox "Repo directory" 10 60 "."` gitdir=`dialog --stdout --inputbox "Repo directory" 10 60 "."`
if [ $(echo $gitdir | cut -f1 -d"/") = "~" ];then #~ don't understand like $HOME if [ $(echo $gitdir | cut -f1 -d"/") = "~" ];then #~ don't understand like $HOME
@@ -23,63 +23,65 @@ case $gitopt in
do do
gitdirdef="$gitdirdef/$(echo $gitdir | cut -f$i -d"/")" gitdirdef="$gitdirdef/$(echo $gitdir | cut -f$i -d"/")"
done done
elif [ $(echo $gitdit | cut -f1 -d"/") = "." ];then elif [ $(echo $gitdit | cut -f1 -d"/") = "." ];then
gitdirdef=$(pwd) gitdirdef=$(pwd)
for (( i=1; i<=$cant; i++ )) for (( i=1; i<=$cant; i++ ))
do do
gitdirdef="$gitdirdef/$(echo $gitdir | cut -f$i -d"/")" gitdirdef="$gitdirdef/$(echo $gitdir | cut -f$i -d"/")"
done done
fi fi
if [ ! -d $gitdir ];then if [ ! -d $gitdir ];then
mkdir -p $gitdirdef mkdir -p $gitdirdef
fi fi
if [ $? -eq 1 ];then if [ $? -eq 1 ];then
echo "You dont have permission to write in this directory" >> /dev/stderr echo "You dont have permission to write in this directory" >> /dev/stderr
else else
cd $gitdirdef cd $gitdirdef
git init git init
fi fi
;; ;;
"c") "c")
giturl=`dialog --stdout --inputbox "URL del git" 10 60` giturl=`dialog --stdout --inputbox "git URL: " 10 60`
if [ -z $giturl ];then if [ -z $giturl ];then
echo "No repository there." echo "No URL specified."
exit exit
fi fi
git clone $giturl git clone $giturl
;; ;;
#Staying in a git repo
"p")
git pull $actual;; #Options of a git repo
"s") "p")
estado=$(git status | grep -E '(^Changes|^Untracked)' ) #It need to commit something? git pull $actual;;
if [ "$estado" ];then #When is necesary commit "s")
commit=`dialog --stdout --inputbox "Changes text: " 10 50 "changes"` estado=$(git status | grep -E '(^Changes|^Untracked)' ) #It need to commit something?
if [[ -z $commit ]];then if [ "$estado" ];then #When is necesary commit
commit=`dialog --stdout --inputbox "Changes text: " 10 50 "changes"`
if [[ -z $commit ]];then
commit="changes" commit="changes"
fi fi
git add -A && git commit -m "$commit" && git push $actual git add -A && git commit -m "$commit" && git push $actual
else #Nothing to commit, only push else #Nothing to commit, only push
git push $actual git push $actual
fi fi
;; ;;
"t") "t")
commit=`dialog --stdout --inputbox "Changes text: " 10 50 "changes"` commit=`dialog --stdout --inputbox "Changes text: " 10 50 "changes"`
if [[ -z $commit ]];then if [[ -z $commit ]];then
commit="changes" commit="changes"
fi fi
git add -A && git commit -m "$commit" git add -A && git commit -m "$commit"
;; ;;
"b") "b")
howopt=`dialog --stdout --scrollbar --menu "Change branch" 0 0 6 c "Only change branch" u "Change branch and update it"` howopt=`dialog --stdout --scrollbar --menu "Change branch" 0 0 6 c "Only change branch" u "Change branch and update it"`
if [ -z $howopt ];then if [ -z $howopt ];then
exit exit
fi fi
j=0 j=0
rama="" rama=""
#Loop to create dialog whith all branches (except the current) #Loop to create dialog whith all branches (except the current)
for i in $(git branch -a | grep -v "^*" | grep -v "HEAD \->") for i in $(git branch -a | grep -v "^*" | grep -v "HEAD \->")
do do
aux2=0 aux2=0
if [ -z $(echo $i | grep -o "remotes") ];then if [ -z $(echo $i | grep -o "remotes") ];then
aux=$i aux=$i
@@ -102,48 +104,48 @@ do
lista[$j]=$aux #Array with the names of branches lista[$j]=$aux #Array with the names of branches
let j++ let j++
fi fi
done done
ramificacion=`dialog --stdout --scrollbar --menu "Select branch to goto" 0 0 6 $rama` ramificacion=`dialog --stdout --scrollbar --menu "Select branch to goto" 0 0 6 $rama`
if [ ! -z $ramificacion ];then if [ ! -z $ramificacion ];then
git checkout ${lista[$ramificacion]} git checkout ${lista[$ramificacion]}
if [ $howopt = "u" ];then if [ $howopt = "u" ];then
git pull origin ${lista[$ramificacion]} git pull origin ${lista[$ramificacion]}
fi fi
fi fi
;; ;;
"n") "n")
NewBranch=`dialog --stdout --inputbox "Name of the new branch" 10 50 "New branch"` NewBranch=`dialog --stdout --inputbox "Name of the new branch" 10 50 "New branch"`
if [ ! -z $NewBranch ];then if [ ! -z $NewBranch ];then
git checkout -b $NewBranch git checkout -b $NewBranch
fi fi
;; ;;
"m") "m")
j=0 j=0
rama="" rama=""
for i in $(git branch --list | grep "^*" -v ) for i in $(git branch --list | grep "^*" -v )
do do
if [ $i != "*" ];then if [ $i != "*" ];then
rama="$rama $j $i" rama="$rama $j $i"
lista[$j]=$i lista[$j]=$i
let j++ let j++
fi fi
done done
merges=`dialog --stdout --scrollbar --menu "Select branch for merge to $(git branch --list | grep "^*" | cut -f2 -d" ")" 0 0 6 $rama` merges=`dialog --stdout --scrollbar --menu "Select branch for merge to $(git branch --list | grep "^*" | cut -f2 -d" ")" 0 0 6 $rama`
if [ ! -z $merges ];then if [ ! -z $merges ];then
git merge ${lista[$merges]} git merge ${lista[$merges]}
git push $actual git push $actual
fi fi
;; ;;
"d") "d")
var=1 var=1
while [[ $var -eq 1 ]]; do while [[ $var -eq 1 ]]; do
if [[ $(ls -a | grep .git) ]]; then if [[ $(ls -a | grep .git) ]]; then
var=0 var=0
else else
cd .. cd ..
fi fi
done done
git checkout .; git checkout .;
;; ;;
esac esac
fi fi