From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 21048 invoked from network); 13 Sep 2008 15:21:39 -0000 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00 autolearn=ham version=3.2.5 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by ns1.primenet.com.au with SMTP; 13 Sep 2008 15:21:39 -0000 Received-SPF: none (ns1.primenet.com.au: domain at sunsite.dk does not designate permitted sender hosts) Received: (qmail 70919 invoked from network); 13 Sep 2008 15:21:29 -0000 Received: from sunsite.dk (130.225.247.90) by a.mx.sunsite.dk with SMTP; 13 Sep 2008 15:21:29 -0000 Received: (qmail 12090 invoked by alias); 13 Sep 2008 15:21:25 -0000 Mailing-List: contact zsh-workers-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 25658 Received: (qmail 12076 invoked from network); 13 Sep 2008 15:21:24 -0000 Received: from bifrost.dotsrc.org (130.225.254.106) by sunsite.dk with SMTP; 13 Sep 2008 15:21:24 -0000 Received: from fg-out-1718.google.com (fg-out-1718.google.com [72.14.220.156]) by bifrost.dotsrc.org (Postfix) with ESMTP id 32EF080307AD for ; Sat, 13 Sep 2008 17:21:16 +0200 (CEST) Received: by fg-out-1718.google.com with SMTP id e21so813142fga.37 for ; Sat, 13 Sep 2008 08:21:15 -0700 (PDT) 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= Received: by 10.180.208.5 with SMTP id f5mr3971613bkg.62.1221319274871; Sat, 13 Sep 2008 08:21:14 -0700 (PDT) Received: from ?192.168.1.3? ( [87.123.210.167]) by mx.google.com with ESMTPS id p9sm11968023fkb.5.2008.09.13.08.21.13 (version=TLSv1/SSLv3 cipher=RC4-MD5); Sat, 13 Sep 2008 08:21:14 -0700 (PDT) Message-ID: <48CBDA72.8090105@gmail.com> Date: Sat, 13 Sep 2008 17:21:22 +0200 User-Agent: Thunderbird 2.0.0.16 (X11/20080811) MIME-Version: 1.0 To: zsh-workers@sunsite.dk Subject: [PATCH] completion for opensolaris IPS package manager Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 8bit From: =?ISO-8859-1?Q?=22xRaich=5Bo=5D=B2x=22?= X-Virus-Scanned: ClamAV 0.92.1/8230/Sat Sep 13 02:08:14 2008 on bifrost X-Virus-Status: Clean 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