From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: zsh-workers-return-43784-ml=inbox.vuxu.org@zsh.org X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-1.1 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=ham autolearn_force=no version=3.4.2 Received: from primenet.com.au (ns1.primenet.com.au [203.24.36.2]) by inbox.vuxu.org (OpenSMTPD) with ESMTP id 5478e0cd for ; Wed, 7 Nov 2018 10:43:44 +0000 (UTC) Received: (qmail 25727 invoked by alias); 7 Nov 2018 10:43:29 -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: 43784 Received: (qmail 5235 invoked by uid 1010); 7 Nov 2018 10:43:29 -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.7/5.0):. Processed in 1.869164 secs); 07 Nov 2018 10:43:29 -0000 X-Envelope-From: SRS0=hFvW=NS=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=1541586961; bh=OvXDd+8OC2jNdukWtg3mZ4+cbmnsWe0miCglmI4DEqM=; h=From:References:To:Subject:Date:From:Subject; b=m54iD3hlJXJZ0NroiojTzKoh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w RcxGfFmgeFTkuxsGIpkVa5seczSQrwNhO4viVHVwqppiHlEECxNTpZnen3SFNc0L40OfmE_AaLAP NFUGS_NzVEpBdq1sY_mYPWTTwtyDv5Mf6cWtuJ94ajHVKZ6K33QY_Si20FCIQMTGo4MoIlBJEmEk .Zo1g7AWbSsuLnXBGd.oKlHvEg8GeJuXamvvVMDZn9HxgydHcar1YRbkd.b9UBY.wcIbxhqsUKV8 fu9dEAPLeuCe9DQBq34raS3_sGVxyndiMKmCEVxnVqzx8qJfPX7dgYH9mH_h4chSIs35TEH74AuH hSHzIDqpXd0oVJrs- In-reply-to: <75B26F45-E6E6-44BB-80A4-7301CBE480FE@dana.is> From: Oliver Kiddle References: <75B26F45-E6E6-44BB-80A4-7301CBE480FE@dana.is> To: dana , Zsh workers Subject: Re: [PATCH] Completion: Sort lz4 compression levels properly (+ a question) MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <88811.1541586959.1@hydra> Date: Wed, 07 Nov 2018 11:35:59 +0100 Message-ID: <88812-1541586959.338018@YaNA.ZOZt.NKaA> On 3 Nov, dana wrote: > > Is there a better way to do this? Off the top of my head i came up with either You can do: _arguments '-b-:level: compadd "${(@)expl/#-J/-2V}" ${(on)levels}' But what you have is perhaps better, especially as it's duplicated for -b and -e. I was thinking that you just needed to put - in where you wanted _arguments to add the options but it's actually _sequence that does that. > If there's no generic way to do it, would it make sense to have some kind of > spec modifier that tells action forms like `(item ...)` that -V should be used, > or, if that's too weird, a helper function (_presorted maybe) that just wraps I'm not especially enthused about adding more special syntax to _arguments. The compadd interface perhaps isn't ideal. If -V was a standalone option like -1 and -2, intended to be used in combination with -J (to specify the group name), then it would be easier to modify the sort order. There's also the -o option which (per-match rather than per-group) says that the display string should be used when comparing matches for the purpose of sorting. As far as I can tell, -o has never been used. Sorting by the description part of the display string would be useful. Can we improve it without breaking backward compatibility. -o with an argument could allow for more sorting options, e.g. -o numeric to do numeric sorting. Do we need to be concerned that someone somewhere may actually be using -o? The help descriptions in compadd completion had things the wrong way around for -o which this fixes. Also, the help for -V is perhaps somewhat confusing. "unsorted" was used to mean "will not be sorted" but is often used when you have already pre-sorted the matches. Oliver diff --git a/Completion/Zsh/Command/_compadd b/Completion/Zsh/Command/_compadd index a7036d027..e709e400e 100644 --- a/Completion/Zsh/Command/_compadd +++ b/Completion/Zsh/Command/_compadd @@ -14,9 +14,9 @@ _arguments -C -s -S -A "-*" \ '(-a)-k[matches are keys of specified associative arrays]' \ '-d+[specify display strings]:array:_parameters -g "*array*"' \ '-l[list display strings one per line, not in columns]' \ - '-o[order matches by display string not by match string]' \ - '(-1 -E)-J+[specify match group]:group' \ - '-V+[specify unsorted match group]:group' \ + '-o[order matches by match string not by display string]' \ + '(-1 -E)-J+[specify match group which will be sorted]:group' \ + '-V+[specify pre-ordered match group]:group' \ '(-J -E)-1[remove only consecutive duplicates from group]' \ '-2[preserve all duplicates]' \ '(-x)-X[specify explanation]:explanation' \