mirror of
https://gitlab.com/dwt1/dotfiles.git
synced 2023-02-13 20:55:19 -05:00
Merge branch 'nicolast88-master-patch-14859' into 'master'
Update .zshrc See merge request dwt1/dotfiles!18
This commit is contained in:
commit
7fab04a031
1 changed files with 41 additions and 25 deletions
60
.zshrc
60
.zshrc
|
@ -41,33 +41,49 @@ case ${TERM} in
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
### ARCHIVE EXTRACTION
|
### Function extract for common file formats ###
|
||||||
# usage: ex <file>
|
SAVEIFS=$IFS
|
||||||
ex ()
|
IFS=$(echo -en "\n\b")
|
||||||
{
|
|
||||||
if [ -f $1 ] ; then
|
function extract {
|
||||||
case $1 in
|
if [ -z "$1" ]; then
|
||||||
*.tar.bz2) tar xjf $1 ;;
|
# display usage if no parameters given
|
||||||
*.tar.gz) tar xzf $1 ;;
|
echo "Usage: extract <path/file_name>.<zip|rar|bz2|gz|tar|tbz2|tgz|Z|7z|xz|ex|tar.bz2|tar.gz|tar.xz>"
|
||||||
*.bz2) bunzip2 $1 ;;
|
echo " extract <path/file_name_1.ext> [path/file_name_2.ext] [path/file_name_3.ext]"
|
||||||
*.rar) unrar x $1 ;;
|
else
|
||||||
*.gz) gunzip $1 ;;
|
for n in "$@"
|
||||||
*.tar) tar xf $1 ;;
|
do
|
||||||
*.tbz2) tar xjf $1 ;;
|
if [ -f "$n" ] ; then
|
||||||
*.tgz) tar xzf $1 ;;
|
case "${n%,}" in
|
||||||
*.zip) unzip $1 ;;
|
*.cbt|*.tar.bz2|*.tar.gz|*.tar.xz|*.tbz2|*.tgz|*.txz|*.tar)
|
||||||
*.Z) uncompress $1;;
|
tar xvf "$n" ;;
|
||||||
*.7z) 7z x $1 ;;
|
*.lzma) unlzma ./"$n" ;;
|
||||||
*.deb) ar x $1 ;;
|
*.bz2) bunzip2 ./"$n" ;;
|
||||||
*.tar.xz) tar xf $1 ;;
|
*.cbr|*.rar) unrar x -ad ./"$n" ;;
|
||||||
*.tar.zst) unzstd $1 ;;
|
*.gz) gunzip ./"$n" ;;
|
||||||
*) echo "'$1' cannot be extracted via ex()" ;;
|
*.cbz|*.epub|*.zip) unzip ./"$n" ;;
|
||||||
|
*.z) uncompress ./"$n" ;;
|
||||||
|
*.7z|*.arj|*.cab|*.cb7|*.chm|*.deb|*.dmg|*.iso|*.lzh|*.msi|*.pkg|*.rpm|*.udf|*.wim|*.xar)
|
||||||
|
7z x ./"$n" ;;
|
||||||
|
*.xz) unxz ./"$n" ;;
|
||||||
|
*.exe) cabextract ./"$n" ;;
|
||||||
|
*.cpio) cpio -id < ./"$n" ;;
|
||||||
|
*.cba|*.ace) unace x ./"$n" ;;
|
||||||
|
*)
|
||||||
|
echo "extract: '$n' - unknown archive method"
|
||||||
|
return 1
|
||||||
|
;;
|
||||||
esac
|
esac
|
||||||
else
|
else
|
||||||
echo "'$1' is not a valid file"
|
echo "'$n' - file does not exist"
|
||||||
|
return 1
|
||||||
fi
|
fi
|
||||||
|
done
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
IFS=$SAVEIFS
|
||||||
|
|
||||||
### OH MY ZSH ###
|
### OH MY ZSH ###
|
||||||
|
|
||||||
# Path to your oh-my-zsh installation.
|
# Path to your oh-my-zsh installation.
|
||||||
|
|
Loading…
Add table
Reference in a new issue