mirror of
https://gitlab.com/JKANetwork/jka-toolkit.git
synced 2026-02-19 03:21:32 +01:00
add listing mode to jkazip
This commit is contained in:
@@ -2,7 +2,6 @@
|
||||
#JKA - ZIP
|
||||
#A script for de/compress files and folders in many formats
|
||||
#Author: JKA Network - contacto@jkanetwork.com
|
||||
#Function decompress(); decompress the file whith the format especified
|
||||
|
||||
# gettext initialization
|
||||
export TEXTDOMAIN='jkazip'
|
||||
@@ -40,7 +39,7 @@ function msg2() {
|
||||
echo
|
||||
}
|
||||
|
||||
version="2.0.3"
|
||||
version="2.3.0"
|
||||
if [ -z "$1" ];then
|
||||
echo "$(gettext "No option specified, use jkazip -h")" > /dev/stderr
|
||||
elif [ "$1" = "-h" ];then
|
||||
@@ -48,6 +47,7 @@ elif [ "$1" = "-h" ];then
|
||||
echo ""
|
||||
echo "$(gettext " -d, decompress file")"
|
||||
echo "$(gettext " -c <output file>, compress file")"
|
||||
echo "$(gettext " -l, list all files")"
|
||||
echo "$(gettext " -h, show help box and exit")"
|
||||
echo "$(gettext " -v, show version and exit")"
|
||||
echo ""
|
||||
@@ -178,6 +178,38 @@ elif [ "$1" = "-c" ];then
|
||||
echo > /dev/stderr
|
||||
;;
|
||||
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")
|
||||
zip -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
|
||||
echo "$(gettext "Unknown option")" > /dev/stderr
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user