#!/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 "Packing/unpacking supported extensions:" echo " 7z, bz2, gz, rar, tar, tar.bz2, tbz, tbz2, tb2, tar.gz, tgz, tar.xz, txz, zip" echo "" echo "Unpacking only supported extensions:" echo " arj, cab, dmg, iso, lzh, lzma, rpm, squashfs, vdi, vhd, vmdk, win, xar, z" 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 "7z" "bzip2" "gzip" "rar" "tar" "unrar" "unzip" "zip" 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." echo -e "Or use 'lch -i' to install all dependences" fi echo "" } function lowercase() { echo "$DEST" | tr 'A-Z' 'a-z' } function error_not_install() { echo -e "$@ \e[91mis not installed\e[0m, use 'lch -i' to install and 'lch -c' to check." exit 0 } function executer() { if [ -x "$(command -v $1)" ] then "$@" else error_not_install $1 fi } function complete_install(){ echo -e "$@:\t\t\t\e[32mComplete\e[0m" } function failed_install(){ echo -e "$@:\t\t\t\e[91mFailed\e[0m" }