From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 24021 invoked by alias); 5 Jan 2018 23:51:05 -0000 Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Workers List List-Post: List-Help: List-Unsubscribe: X-Seq: 42235 Received: (qmail 28754 invoked by uid 1010); 5 Jan 2018 23:51:05 -0000 X-Qmail-Scanner-Diagnostics: from park01.gkg.net by f.primenet.com.au (envelope-from , uid 7791) with qmail-scanner-2.11 (clamdscan: 0.99.2/21882. spamassassin: 3.4.1. Clear:RC:0(205.235.26.22):SA:0(-1.4/5.0):. Processed in 10.506673 secs); 05 Jan 2018 23:51:05 -0000 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-1.4 required=5.0 tests=BAYES_00, FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS, SPF_PASS,T_DKIM_INVALID,T_RP_MATCHES_RCVD autolearn=no autolearn_force=no version=3.4.1 X-Envelope-From: SRS0=bkm2=EA=yahoo.co.uk=okiddle@bounces.park01.gkg.net X-Qmail-Scanner-Mime-Attachments: | X-Qmail-Scanner-Zip-Files: | X-Virus-Scanned: by amavisd-new at gkg.net Authentication-Results: amavisd4.gkg.net (amavisd-new); dkim=pass (2048-bit key) header.d=yahoo.co.uk X-Greylist: domain auto-whitelisted by SQLgrey-1.8.0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.co.uk; s=s2048; t=1515196238; bh=KwymdTmeq654Mg2TIAvzZTkBU5cq7DbY+OMWSlrQrx4=; h=From:References:To:Subject:Date:From:Subject; b=Q+vk2ENIZn8AY85eQqpBylXsculjqYIUXuCqpndq5Hyx7apWOSECDc/jAsHYqOULZ+/FRKtVqhzK2LA6Uos7ah83exeN78HpHpc+JTZu6AcMVKnNOZS5/icJM5jhJMqhDwhB1NCrb5jA942c2bHPUf0GX7mIGCKfo2kBOUV/1wt/B9pyV/uD95g3u/ZyuxQNfXrbsVFa8X4I8Mh3DumDHwsyFVcCADMp1owv44F1aR2wSK+jwv+Aay8VGZEflLNL2gVIvwTUp+WErqkVxBOvuu+cuMAC4snU3uIZ5FOIpuDG1BGxHdV72w5g0HtivvjuTlQi0ykQWNa2Rzoa3dRQUA== X-YMail-OSG: ibLalu0VM1kuL_1HSaw8blgOtTDNV3_9NJjE4Y3RpM_Lv9nGnnprIUi0Dmzh2n4 ZLw3jKCGojA6dhXscxjlRSpfwrjVB.1x8NUOK.2izsr4EX2D0_1SzxdkwQ9EIrZEJ01Pc2YlWLn0 Fj_myjlsSocutkzYDmF2xmH0UhVZvhTAng6nv_apYFoJhNfLMXromwwYnSBc3oxtQFk2ljH73aZi n8WjQMbPFu4Ln7IJd_0fbR3OnAh_sdnkv5erl5E3GS1TI2ZXd1tmGkolmcEQ52EdVPAHjzuejeC0 pQFUWWJQVYNDyZ4ZesrxD6HXbNfib1PSEZQI_6ZUVV_G_AwUIfh2X2_.gMe7bSrYkcAJZtEuD0n2 9eligANW0w4vxHzNbde3FvVkxXlSUUPa82uoGdWvQhPq7XIwWBVITKXaymF3FvkhE6KabtNRp4bH 9_yX5ofReTzUo5NtXek96tvuX_fzfgpDAWXIKTB_RiT6DQBm.3iRZrcSOH38inInOAgTf In-reply-to: <4553C21B-67DD-4E1C-BE56-F662E63F7FF5@dana.is> From: Oliver Kiddle References: <4553C21B-67DD-4E1C-BE56-F662E63F7FF5@dana.is> To: zsh-workers@zsh.org Subject: Re: [PATCH] Completion batch #5: Simple Darwin and Linux utilities MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-ID: <26359.1515196233.1@thecus.kiddle.eu> Content-Transfer-Encoding: 8bit Date: Sat, 06 Jan 2018 00:50:33 +0100 Message-ID: <26360.1515196233@thecus.kiddle.eu> dana wrote: > New functions for simple utilities belonging to the 'Darwin' and 'Linux' groups. Thanks, I've committed these. That is with the exception of Linux/Command/_ldd – there's already a completion for ldd in Unix/Command that also handles Solaris and the BSDs. ldconfig also exists outside of Linux but in a different form so may need moving later. > +[[ $state == variables-* ]] && { > + tmp=( ${${(f)"$( command $service -p )"}%%[[:space:]]*} ) Ideally, you should use _call_program when calling external commands as that allows the program to be disabled or overridden. It is also better in general to use $words[1] instead of $service in case a command is specified by the user with a full path and there's another version of the command elsewhere in $PATH. > +#compdef plutil > +local -a context line state state_descr tmp fmts=( xml1 binary1 json ) > +_arguments -s -S : \ > + '(-convert -extract -replace -remove)-insert[insert value at specified key path into property list]: :->k: :->t: :->v' \ > + _values 'value type' $tmp && ret=0 To elaborate on what I was explaining with contexts, after completion with: plutil -insert _arguments will set context=( set2-option-insert-1 ) The idea is that when looking up styles with zstyle, this should be included. Unlike _wanted, _alternative, _tags and others, this can't be passed on to _values other than in $curcontext. So in this case, using _arguments -C might be better. > +# Don't complete host names unless we have -r (this is weird, but the obvious > +# alternative (exclusion sets) currently doesn't work properly with option > +# stacking) Can you elaborate on what doesn't work here? Sets have some oddities and are often better avoided. Oliver