Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
[PATCH] completion for opensolaris IPS package manager
- X-seq: zsh-workers 25658
- From: "xRaich[o]²x" <raichoo@xxxxxxxxxxxxxx>
- To: zsh-workers@xxxxxxxxxx
- Subject: [PATCH] completion for opensolaris IPS package manager
- Date: Sat, 13 Sep 2008 17:21:22 +0200
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:user-agent :mime-version:to:subject:content-type:content-transfer-encoding:from; bh=GEeX4XLDDbkIokmZ+dPMKy/VzTKW4aM8ySwKW2l/GTo=; b=EhFbutnAQb0XMSGWhmhyaoKnOhLQk8C13ofMCBWZEre2+b8VSx0f/zIvmDuNvtgymB Wv39J78aVvvlzPiNb63XsQPcHus8Iq6kVgRRtvyWHhJ6P1+95R9GhFRGjvz0AxzovTJ/ bM2DNg6nIixuFpBuunhRTmJ5wtI+M75QNrgaE=
- Domainkey-signature: a=rsa-sha1; c=nofws; d=googlemail.com; s=gamma; h=message-id:date:user-agent:mime-version:to:subject:content-type :content-transfer-encoding:from; b=rE4EnKxPdEGH6njp0ARKNELMso6G9sGM17e7j+4362ovaMFUZBy4PvdesDeNLKWFhK sYt1h2KuRLuZdmFPvtKdc9+uwUj6vW2v0xre/hMoNlDEtndHcZSflmTdk7+aWuumhkE8 ng8N0JwDTUQ/oM+x4C5miifX4Z3eez5gf8+dM=
- Mailing-list: contact zsh-workers-help@xxxxxxxxxx; run by ezmlm
I started working on some scripts for opensolaris commands (zpool, zfs,
beadm and more are in the works). Here is the first for package
management. It's still pretty basic but supports the features that are
used the most (or at least i use the most ^^)
#compdef pkg
cmds=(
'install:install a package'
'uninstall:uninstall a package'
'verify:verify a package'
'info:fetch package info'
'contents:show package contents'
'list:list installed packages'
'search:search for a package'
'refresh:refresh catalogues'
'image-create:create new image'
'image-update:update an image'
'set-authority:set an authority'
'unset-authority:unset an authority'
'authority:list authorities'
'rebuild-index:rebuild index'
)
_pkg () {
ret=1
SHIFTER=0
if [[ $words[2] == "-R" ]]; then
if (( CURRENT == 3 )); then
_directories && ret=0
return ret
elif (( CURRENT >= 4 )); then
SHIFTER=2
fi
fi
if (( CURRENT-SHIFTER == 2 )); then
_describe 'pkg command' cmds && ret=0
else
case ${words[$(( 2 + SHIFTER ))]} in
install)
compadd $(awk $'{print $3}' $(find /var/pkg/catalog
-name catalog -type f) | sort -u) && ret=0
;;
uninstall|verify)
compadd $(/usr/bin/ls /var/pkg/state/installed | cut -d@
-f1) && ret=0
;;
search|info|contents)
if [[ $words[$(( 3 + SHIFTER ))] == "-r" ]]; then
compadd $(awk $'{print $3}' $(find /var/pkg/catalog
-name catalog -type f) | sort -u) && ret=0
else
compadd $(/usr/bin/ls /var/pkg/state/installed |
cut -d@ -f1) && ret=0
fi
;;
refresh|unset-authority)
compadd $(find /var/pkg/catalog/ -type d | sed 1d | cut
-d/ -f5) && ret=0
esac
fi
return ret
}
Regards,
Björn
Messages sorted by:
Reverse Date,
Date,
Thread,
Author