mirror of
https://gitlab.com/JKANetwork/jka-toolkit.git
synced 2026-02-15 09:31:32 +01:00
Merge branch 'hotfix'
This commit is contained in:
@@ -5,11 +5,11 @@ GENERAL USAGE NOTES
|
|||||||
--------------------
|
--------------------
|
||||||
* JKA Toolkit is a set of script to make easiest of Linux terminal
|
* JKA Toolkit is a set of script to make easiest of Linux terminal
|
||||||
* Now this kit include:
|
* Now this kit include:
|
||||||
* apw - a package wrapper - Version 1.8
|
* apw - a package wrapper - Version 1.9
|
||||||
* A wrapper to manage package managers of the differents Linux distributions, compatible with the families of *Debian, Archlinux, RedHat, CentOS, OpenSuse* and *Void Linux*
|
* A wrapper to manage package managers of the differents Linux distributions, compatible with the families of *Debian, Archlinux, RedHat, CentOS, OpenSuse* and *Void Linux*
|
||||||
* jkazip - Version 2.0.2
|
* jkazip - Version 2.0.3
|
||||||
* A script which use the differents zip and unzip programs, support *tar, lzip, lzma (xz), zip, 7zip, gzip, bzip2* and *rar* (only for unzip)
|
* A script which use the differents zip and unzip programs, support *tar, lzip, lzma (xz), zip, 7zip, gzip, bzip2* and *rar* (only for unzip)
|
||||||
* gitdit - GIT DIalog inTerface Version 0.1
|
* gitdit - GIT DIalog inTerface Version 0.2.2
|
||||||
* A dialog interface to manage git repositories with *pull, add-commit-push, clone, checkout,* and *merge*
|
* A dialog interface to manage git repositories with *pull, add-commit-push, clone, checkout,* and *merge*
|
||||||
|
|
||||||
Contact
|
Contact
|
||||||
|
|||||||
@@ -1,63 +1,91 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
VERSION="0.2.0"
|
# gitdit, a dialog interface to manage git repositories
|
||||||
gitopt=`dialog --stdout --scrollbar --menu "gitdit - Git DIalog inTerface" 0 0 6 p "Descargar actualizaciones del git (Hacer pull)" t "Confirmar cambios sin subida" s "Subir actualizaciones al git (Hacer push)" c "Descargar un nuevo git (Hacer clone)" n "Crear nueva rama" b "Cambiar de branch/rama (Hacer checkout)" m "Unir ramas (Hacer merge a la rama actual)"`
|
# Author: JKA Network - contacto@jkanetwork.com
|
||||||
actual="origin $(git branch --list | grep "^*" | cut -f2 -d" ")"
|
|
||||||
case $gitopt in
|
VERSION="0.2.3"
|
||||||
"p") git pull $actual;;
|
#First check if the user is in a git repository
|
||||||
"s") commit=`dialog --stdout --inputbox "Cambios (texto commit)" 10 50 "changes"`
|
preOption=$(git status 2>/dev/stdout | sed -n 1p | cut -f2 -d" ")
|
||||||
if [[ -z $commit ]];then
|
if [ $preOption = "Not" ];then #When it isn't only it can do git clone
|
||||||
commit="changes"
|
gitopt=`dialog --stdout --scrollbar --menu "gitdit - Git DIalog inTerface" 0 0 6 c "Descargar un nuevo repo (Hacer clone)"" i "Inicializar nuevo repo"`
|
||||||
fi
|
else #Else, all other options
|
||||||
git add . && git commit -m "$commit" && git push $actual
|
gitopt=`dialog --stdout --scrollbar --menu "gitdit - Git DIalog inTerface" 0 0 6 p "Descargar actualizaciones del git (Hacer pull)" t "Confirmar cambios sin subida" s "Subir actualizaciones al git (Hacer push)" n "Crear nueva rama" b "Cambiar de branch/rama (Hacer checkout)" m "Unir ramas (Hacer merge)"`
|
||||||
;;
|
actual="origin $(git branch --list | grep "^*" | cut -f2 -d" ")" #Current branch
|
||||||
"c")
|
fi
|
||||||
giturl=`dialog --stdout --inputbox "URL del git" 10 60`
|
if [ ! -z $gitopt ];then #No canceled
|
||||||
git clone $giturl
|
case $gitopt in
|
||||||
;;
|
#Not staying in a git repo
|
||||||
"t")
|
"i")
|
||||||
commit=`dialog --stdout --inputbox "Cambios (texto commit)" 10 50 "changes"`
|
git init
|
||||||
if [[ -z $commit ]];then
|
;;
|
||||||
commit="changes"
|
"c")
|
||||||
fi
|
giturl=`dialog --stdout --inputbox "URL del git" 10 60`
|
||||||
git add . && git commit -m "$commit"
|
if [ -z $giturl ];then
|
||||||
;;
|
echo "Ningún repositorio especificado"
|
||||||
"b")
|
exit
|
||||||
j=0
|
fi
|
||||||
rama=""
|
git clone $giturl
|
||||||
for i in $(git branch --list | grep "^*" -v )
|
;;
|
||||||
do
|
#Staying in a git repo
|
||||||
if [ $i != "*" ];then
|
"p")
|
||||||
rama="$rama $j $i"
|
git pull $actual;;
|
||||||
lista[$j]=$i
|
"s")
|
||||||
let j++
|
estado=$(git status | grep "^Changes" ) #It need to commit something?
|
||||||
|
if [ $estado ];then #When is necesary commit
|
||||||
|
commit=`dialog --stdout --inputbox "Cambios (texto commit)" 10 50 "changes"`
|
||||||
|
if [[ -z $commit ]];then
|
||||||
|
commit="changes"
|
||||||
|
fi
|
||||||
|
git add . && git commit -m "$commit" && git push $actual
|
||||||
|
else #Nothing to commit, only push
|
||||||
|
git push $actual
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
"t")
|
||||||
|
commit=`dialog --stdout --inputbox "Cambios (texto commit)" 10 50 "changes"`
|
||||||
|
if [[ -z $commit ]];then
|
||||||
|
commit="changes"
|
||||||
|
fi
|
||||||
|
git add . && git commit -m "$commit"
|
||||||
|
;;
|
||||||
|
"b")
|
||||||
|
j=0
|
||||||
|
rama=""
|
||||||
|
#Loop to create dialog whith all branches (except the current)
|
||||||
|
for i in $(git branch --list | grep "^*" -v )
|
||||||
|
do
|
||||||
|
if [ $i != "*" ];then
|
||||||
|
rama="$rama $j $i"
|
||||||
|
lista[$j]=$i #Array with the names of branches
|
||||||
|
let j++
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
ramificacion=`dialog --stdout --scrollbar --menu "Selecione la rama a saltar" 0 0 6 $rama`
|
||||||
|
if [ ! -z $ramificacion ];then
|
||||||
|
git checkout ${lista[$ramificacion]}
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
"n")
|
||||||
|
NewBranch=`dialog --stdout --inputbox "Nombre de la nueva rama" 10 50 "new branch"`
|
||||||
|
if [ ! -z $NewBranch ];then
|
||||||
|
git checkout -b $NewBranch
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
"m")
|
||||||
|
j=0
|
||||||
|
rama=""
|
||||||
|
for i in $(git branch --list | grep "^*" -v )
|
||||||
|
do
|
||||||
|
if [ $i != "*" ];then
|
||||||
|
rama="$rama $j $i"
|
||||||
|
lista[$j]=$i
|
||||||
|
let j++
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
merges=`dialog --stdout --scrollbar --menu "Selecione la rama a unir a $(git branch --list | grep "^*" | cut -f2 -d" ")" 0 0 6 $rama`
|
||||||
|
if [ ! -z $merges ];then
|
||||||
|
git merge ${lista[$merges]}
|
||||||
|
git push
|
||||||
fi
|
fi
|
||||||
done
|
;;
|
||||||
ramificacion=`dialog --stdout --scrollbar --menu "Selecione la rama a saltar" 0 0 6 $rama`
|
esac
|
||||||
if [ ! -z $ramificacion ];then
|
fi
|
||||||
git checkout ${lista[$ramificacion]}
|
|
||||||
fi
|
|
||||||
;;
|
|
||||||
"n")
|
|
||||||
NewBranch=`dialog --stdout --inputbox "Nombre de la nueva rama" 10 50 "new branch"`
|
|
||||||
if [ ! -z $NewBranch ];then
|
|
||||||
git checkout -b $NewBranch
|
|
||||||
fi
|
|
||||||
;;
|
|
||||||
"m")
|
|
||||||
j=0
|
|
||||||
rama=""
|
|
||||||
for i in $(git branch --list | grep "^*" -v )
|
|
||||||
do
|
|
||||||
if [ $i != "*" ];then
|
|
||||||
rama="$rama $j $i"
|
|
||||||
lista[$j]=$i
|
|
||||||
let j++
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
merges=`dialog --stdout --scrollbar --menu "Selecione la rama a unir a $(git branch --list | grep "^*" | cut -f2 -d" ")" 0 0 6 $rama`
|
|
||||||
if [ ! -z $merges ];then
|
|
||||||
git merge ${lista[$merges]}
|
|
||||||
git push
|
|
||||||
fi
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
Reference in New Issue
Block a user