Browse Source

0.5r1

pull/8/head
Gustavo Adolfo Mesa Roldán 3 years ago
parent
commit
4a276f5a6d
5 changed files with 92 additions and 92 deletions
  1. +35
    -58
      lch
  2. +2
    -6
      lib/compressor.sh
  3. +1
    -4
      lib/decompressor.sh
  4. +0
    -24
      lib/installer.sh
  5. +54
    -0
      lib/resources.sh

+ 35
- 58
lch View File

@ -4,73 +4,50 @@ DEST=$1
shift 1
ORIG=$@
if [[ -e /usr/lib/lch/resources.sh ]]; then . /usr/lib/lch/resources.sh; else . ./lib/resources.sh; fi
if [[ -e /usr/lib/lch/compressor.sh ]]; then . /usr/lib/lch/compressor.sh; else . ./lib/compressor.sh; fi
if [[ -e /usr/lib/lch/decompressor.sh ]]; then . /usr/lib/lch/decompressor.sh; else . ./lib/decompressor.sh; fi
if [[ -e /usr/lib/lch/check.sh ]]; then . /usr/lib/lch/check.sh; else . ./lib/check.sh; fi
if [[ -e /usr/lib/lch/installer.sh ]]; then . /usr/lib/lch/installer.sh; else . ./lib/installer.sh; fi
function help()
{
echo "Help:"
echo "-----"
echo ""
echo "lch [-h] [-v] [-c] [-i] [FILE [FILE...]]"
echo ""
echo "Examples:"
echo "$ lch -h - This help"
echo "$ lch -v - Print version"
echo "$ lch -c - Check compresion systems"
echo "$ lch -i - Install the compressors dependencies"
echo "$ lch file.zip - Decompress"
echo "$ lch file.zip /home/file - Compress"
echo "$ lch files.zip file1 file2 - Compress multiple"
echo ""
echo "Supported extensions:"
echo " rar, tar, tar.gz, tar.bz2, tar.xz, bz2, tgz, gz, zip, 7z"
echo ""
echo "Run 'man lch' for more info."
echo ""
}
if [ "$DEST" = "--help" ] || [ "$DEST" = "-h" ]
then
help
exit 0
fi
if [ "$DEST" = "--check" ] || [ "$DEST" = "-c" ]
then
check
exit 0
fi
if [ "$DEST" = "--install" ] || [ "$DEST" = "-i" ]
then
install $DEST $@
exit 0
fi
if [ "$DEST" = "--version" ] || [ "$DEST" = "-v" ]
then
then
echo "Linux Compression Humanized $VERSION"
exit 0
else
echo -e "\nlch $VERSION"
echo -e "---------\n"
fi
if [ -z "$DEST" ]
then
help
exit 1
else
if [ -n "$ORIG" ]
then
echo "Compressor:"
echo -e "-----------\n"
compressor $DEST $ORIG
else
echo "Decompressor:"
echo -e "-------------\n"
decompressor $DEST
fi
case $DEST in
"--help" | "-h")
help
exit 0
;;
"--check" | "-c")
check
exit 0
;;
"--install" | "-i")
install $DEST $@
exit 0
;;
*)
if [ -z "$DEST" ]
then
help
exit 1
else
if [ -n "$ORIG" ]
then
echo "Compressor:"
echo -e "-----------\n"
compressor $DEST $ORIG
else
echo "Decompressor:"
echo -e "-------------\n"
decompressor $DEST
fi
fi
;;
esac
fi

+ 2
- 6
lib/compressor.sh View File

@ -1,11 +1,7 @@
#!/usr/bin/env bash
function lowercase()
{
echo "$DEST" | tr 'A-Z' 'a-z'
}
function compressor()
{
{
case $(lowercase) in
*.tar)
tar -cvf $DEST $ORIG
@ -39,7 +35,7 @@ function compressor()
echo -e "For more information run 'lch --help'\n"
;;
esac
echo -e "\nDone"
exit 0
}

+ 1
- 4
lib/decompressor.sh View File

@ -1,8 +1,5 @@
#!/usr/bin/env bash
function lowercase()
{
echo "$DEST" | tr 'A-Z' 'a-z'
}
function decompressor()
{
case $(lowercase) in


lib/check.sh → lib/installer.sh View File

@ -1,28 +1,4 @@
#!/usr/bin/env bash
function check()
{
local a=false
echo -e "Verification of compression systems:\n"
echo -e "Systems\t\t\tStatus"
echo "----------------------------------"
for i in "rar" "unrar" "tar" "bzip2" "gzip" "zip" "unzip" "7za"
do
if ! [ -x "$(command -v $i)" ]
then
echo -e "$i\t\t\t\e[91mNot Installed\e[0m"
$a = true
else
echo -e "$i\t\t\t\e[32mInstalled\e[0m"
fi
done
if $a
then
echo -e "\nIn order to use all the extensions install the packages: tar, bzip2, gzip, zip, unzip, 7za, rar, unrar"
fi
echo ""
exit 0
}
function rarInstall(){
if [ -e "$(command -v wget)" ]

+ 54
- 0
lib/resources.sh View File

@ -0,0 +1,54 @@
#!/usr/bin/env bash
function help()
{
echo "Help:"
echo "-----"
echo ""
echo "lch [-h] [-v] [-c] [-i] [FILE [FILE...]]"
echo ""
echo "Examples:"
echo "$ lch -h - This help"
echo "$ lch -v - Print version"
echo "$ lch -c - Check compresion systems"
echo "$ lch -i - Install the compressors dependencies"
echo "$ lch file.zip - Decompress"
echo "$ lch file.zip /home/file - Compress"
echo "$ lch files.zip file1 file2 - Compress multiple"
echo ""
echo "Supported extensions:"
echo " rar, tar, tar.gz, tar.bz2, tar.xz, bz2, tgz, gz, zip, 7z"
echo ""
echo "Run 'man lch' for more info."
echo ""
}
function check()
{
local a=false
echo -e "Verification of compression systems:\n"
echo -e "Systems\t\t\tStatus"
echo "----------------------------------"
for i in "rar" "unrar" "tar" "bzip2" "gzip" "zip" "unzip" "7za"
do
if ! [ -x "$(command -v $i)" ]
then
echo -e "$i\t\t\t\e[91mNot Installed\e[0m"
$a = true
else
echo -e "$i\t\t\t\e[32mInstalled\e[0m"
fi
done
if $a
then
echo -e "\nIn order to use all the extensions install the packages: tar, bzip2, gzip, zip, unzip, 7za, rar, unrar"
fi
echo ""
exit 0
}
function lowercase()
{
echo "$DEST" | tr 'A-Z' 'a-z'
}

Loading…
Cancel
Save