Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
help for a function and its completion
- X-seq: zsh-users 13940
- From: ugaciaka <ugaciaka@xxxxxxxxx>
- To: zsh-users@xxxxxxxxxx
- Subject: help for a function and its completion
- Date: Thu, 19 Mar 2009 22:58:39 +0100
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:sender:received:date :x-google-sender-auth:message-id:subject:from:to:content-type :content-transfer-encoding; bh=X5vnSDYVnSFHiJQ7mFhBe8BjJDw/ydW4bz3SgSxdYeQ=; b=qRb65v5oR7cncmHHJaGl3lj9zdAyu1X7cfXO18CeUNh6NPxATXTkNOq7ls0iondjdf ubiGpooIGlEGkKQEokPPKd1nvVHi90HFaLFsXaq5pMGW9jJSm5cVInco9jvFwM8RgJmJ SimWbPaU0Vo2TqX5He854Z5S4iG01PP1cWdy4=
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:sender:date:x-google-sender-auth:message-id:subject :from:to:content-type:content-transfer-encoding; b=Y8fw0DObAxTXNZswNnmts+JduOcMVuieg/npMe611gsmpoKxY+QqDgK+S3EGPK/DHn MiWJDs+uwL740SmBpFDD6p6sdWLbJML09NZgLBav7EOBqe5skWR4/9xYMI/vbwqHmhpj VU3H6Zx+aMfPUuhCK14fOvbVhNJikwQlLTzDs=
- Mailing-list: contact zsh-users-help@xxxxxxxxxx; run by ezmlm
- Sender: ivan.zanolla@xxxxxxxxx
Hi,
I writed this functions
### functions
#
##################
#extract files eg: ex tarball.tar#
##################
ex () {
if [ -f $1 ] ; then
case $1 in
*.tar.bz2) tar vxjf $1 ;;
*.tar.gz) tar vxzf $1 ;;
*.bz2) bunzip2 $1 ;;
*.rar) unrar x $1 ;;
*.gz) gunzip $1 ;;
*.tar) tar vxf $1 ;;
*.tbz2) tar vxjf $1 ;;
*.tgz) tar vxzf $1 ;;
*.zip) unzip $1 ;;
*.Z) uncompress $1 ;;
*.7z) 7z x $1 ;;
*) echo "$1 non può essere estratto con ex()" ;;
esac
else
echo "$1 non è un archivio valido"
fi
}
##################
#compress directory eg: cm tarball.tar tarball#
##################
cm () {
if [ -d $2 ] ; then
case $1 in
*.tar.bz2) tar vcjf $1 $2 ;;
*.tar.gz) tar vczf $1 $2 ;;
*.bz2) bunzip2 $1 $2 ;;
# *.rar) unrar -e $1 $2 ;;
*.gz) gzip $1 $2 ;;
*.tar) tar vcf $1 $2 ;;
*.tbz2) tar vcjf $1 $2 ;;
*.tgz) tar vczf $1 $2 ;;
*.zip) zip -r $1 $2 ;;
*.Z) compress $1 $2 ;;
*.7z) 7z a -t7z $1 $2 ;;
*) echo "$2 non può essere compresso con cm()" ;;
esac
else
echo "$2 non è un archivio valido"
fi
}
I tried to understand how to write zstyle completion to make your life
easier but are not very good.
I only wish that when I enter, eg,
cm directory directory.tar
postfix tar appear on a list where there are tar, tar.gz, etc.
Maybe I ask too much but a little help, I would make great strides
Thanks
Messages sorted by:
Reverse Date,
Date,
Thread,
Author