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

Merge branch 'development'

This commit is contained in:
kprkpr
2016-07-04 14:05:01 +02:00
3 changed files with 70 additions and 6 deletions

31
jka-toolkit/addit Executable file
View File

@@ -0,0 +1,31 @@
#!/bin/bash
# addit, A script to manage files with dialog
# Author: JKA Network - contacto@jkanetwork.com
VERSION="0.1.0"
options=`dialog --stdout --menu "addit - version: $version" 0 0 6 a "Manage permanent alias"`
case $options in
"a" )
reop=`dialog --stdout --menu "Select option" 0 0 6 0 "Add alias" 1 "Remove alias"`
case $reop in
0)
if [ -z "$(grep -o "if \[ -f ~/.bash_aliases \]; then" $HOME/.bashrc )" ];then
echo "ADD BY ADDIT - PERMIT USE ALIAS" >> $HOME/.bashrc
echo "if [ -f ~/.bash_aliases ]; then" >> $HOME/.bashrc
echo " . ~/.bash_aliases" >> $HOME/.bashrc
echo "fi" >> $HOME/.bashrc
fi
ali=`dialog --stdout --inputbox "Alias name to add" 0 60`
comand=`dialog --stdout --inputbox "Command" 0 60`
echo "alias $ali='$comand'" >> $HOME/.bash_aliases
echo "Restart $(tty)"
;;
1)
ali=`dialog --stdout --inputbox "Alias name to remove" 0 60`
sed -i '/$ali/d' $HOME/bash_aliases
echo "Restart $(tty)"
;;
esac
;;
esac

View File

@@ -2,7 +2,7 @@
# gitdit, a dialog interface to manage git repositories # gitdit, a dialog interface to manage git repositories
# Author: JKA Network - contacto@jkanetwork.com # Author: JKA Network - contacto@jkanetwork.com
VERSION="1.0.0" VERSION="1.0.1"
#First check if the user is in a git repository #First check if the user is in a git repository
preOption=$(git status 2>/dev/stdout | sed -n 1p | cut -f2 -d" ") preOption=$(git status 2>/dev/stdout | sed -n 1p | cut -f2 -d" ")
if [ $preOption = "Not" ];then #When it isn't only it can do git clone if [ $preOption = "Not" ];then #When it isn't only it can do git clone
@@ -47,8 +47,8 @@ if [ ! -z $gitopt ];then #No canceled
"p") "p")
git pull $actual;; git pull $actual;;
"s") "s")
estado=$(git status | grep -o "^Changes" ) #It need to commit something? estado=$(git status | grep -oE "^Changes|^Untracked" ) #It need to commit something?
if [ $estado ];then #When is necesary commit if [ "$estado" ];then #When is necesary commit
commit=`dialog --stdout --inputbox "Cambios (texto commit)" 10 50 "changes"` commit=`dialog --stdout --inputbox "Cambios (texto commit)" 10 50 "changes"`
if [[ -z $commit ]];then if [[ -z $commit ]];then
commit="changes" commit="changes"
@@ -84,7 +84,7 @@ if [ ! -z $gitopt ];then #No canceled
error=0 #If 1 aux is yet in lista array error=0 #If 1 aux is yet in lista array
for (( i=0;i<${#lista[@]} && error==0;i++ )) for (( i=0;i<${#lista[@]} && error==0;i++ ))
do do
if [ $aux =s ${lista[$i]} -o $aux = $actual2 ];then if [ $aux == ${lista[$i]} -o $aux = $actual2 ];then
error=1 error=1
fi fi
done done

View File

@@ -2,7 +2,6 @@
#JKA - ZIP #JKA - ZIP
#A script for de/compress files and folders in many formats #A script for de/compress files and folders in many formats
#Author: JKA Network - contacto@jkanetwork.com #Author: JKA Network - contacto@jkanetwork.com
#Function decompress(); decompress the file whith the format especified
# gettext initialization # gettext initialization
export TEXTDOMAIN='jkazip' export TEXTDOMAIN='jkazip'
@@ -40,7 +39,7 @@ function msg2() {
echo echo
} }
version="2.0.3" version="2.3.0"
if [ -z "$1" ];then if [ -z "$1" ];then
echo "$(gettext "No option specified, use jkazip -h")" > /dev/stderr echo "$(gettext "No option specified, use jkazip -h")" > /dev/stderr
elif [ "$1" = "-h" ];then elif [ "$1" = "-h" ];then
@@ -48,6 +47,7 @@ elif [ "$1" = "-h" ];then
echo "" echo ""
echo "$(gettext " -d, decompress file")" echo "$(gettext " -d, decompress file")"
echo "$(gettext " -c <output file>, compress file")" echo "$(gettext " -c <output file>, compress file")"
echo "$(gettext " -l, list all files")"
echo "$(gettext " -h, show help box and exit")" echo "$(gettext " -h, show help box and exit")"
echo "$(gettext " -v, show version and exit")" echo "$(gettext " -v, show version and exit")"
echo "" echo ""
@@ -178,6 +178,39 @@ elif [ "$1" = "-c" ];then
echo > /dev/stderr echo > /dev/stderr
;; ;;
esac esac
elif [ "$1" = "-l" ];then
if [ -z "$2" ];then
echo "$(gettext "No file or directory specified")" > /dev/stderr
exit
fi
sacaFormato $2
case $formato in
"tar" | "tar.xz" | "tar.lz" | "tar.gz" | "tar.bz2" | "tgz" | "tbz2" | "txz" | "tlz")
tar taf "$2"
;;
"7z")
7z l "$2"
;;
"zip")
unzip -v "$2"
;;
"gz" )
gzip -l "$2"
;;
"xz")
xz -l "$2"
;;
"bz2" | "lz" )
echo "Not supported for listing" > /dev/stderr
;;
"rar")
unrar v "$2"
;;
*)
printf -- "$(gettext "File extension %s are not supported")" $formato > /dev/stderr
echo > /dev/stderr
;;
esac
else else
echo "$(gettext "Unknown option")" > /dev/stderr echo "$(gettext "Unknown option")" > /dev/stderr
fi fi