Add utilities plugin with archive extract
command
This commit is contained in:
parent
ce65ae40bc
commit
b842fb6437
24
utilities/utilities.plugin.zsh
Normal file
24
utilities/utilities.plugin.zsh
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
# A collection of various shell utilities.
|
||||||
|
|
||||||
|
# Detect the type and extract an archive file.
|
||||||
|
extract() {
|
||||||
|
if [ -f $1 ]; then
|
||||||
|
case $1 in
|
||||||
|
*.tar.bz2) tar xvjf $1 ;;
|
||||||
|
*.tar.gz) tar xvzf $1 ;;
|
||||||
|
*.tar.xz) gunzip $1 ;;
|
||||||
|
*.bz2) bunzip2 $1 ;;
|
||||||
|
*.rar) unrar x $1 ;;
|
||||||
|
*.gz) gunzip $1 ;;
|
||||||
|
*.tar) tar xvf $1 ;;
|
||||||
|
*.tbz2) tar xvjf $1 ;;
|
||||||
|
*.tgz) tar xvzf $1 ;;
|
||||||
|
*.zip) unzip $1 ;;
|
||||||
|
*.Z) uncompress $1 ;;
|
||||||
|
*.7z) 7zr x $1 ;;
|
||||||
|
*) echo "error: unable to extract '$1'" ;;
|
||||||
|
esac
|
||||||
|
else
|
||||||
|
echo "error: file not found '$1'"
|
||||||
|
fi
|
||||||
|
}
|
3
zshrc
3
zshrc
@ -31,6 +31,9 @@ source-plugin build
|
|||||||
# Project sandboxing commands
|
# Project sandboxing commands
|
||||||
source-plugin sandbox
|
source-plugin sandbox
|
||||||
|
|
||||||
|
# Various shell utilities
|
||||||
|
source-plugin utilities
|
||||||
|
|
||||||
# Layout tmux window commands
|
# Layout tmux window commands
|
||||||
[ "$TMUX" != "" ] && source-plugin layout
|
[ "$TMUX" != "" ] && source-plugin layout
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user