From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: 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 12554ed6 for ; Sun, 29 Sep 2019 16:01:50 +0000 (UTC) Received: (qmail 24170 invoked by alias); 29 Sep 2019 16:01:45 -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: 44791 Received: (qmail 2678 invoked by uid 1010); 29 Sep 2019 16:01:45 -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.101.2/25580. spamassassin: 3.4.2. Clear:RC:0(205.235.26.22):SA:0(-1.9/5.0):. Processed in 2.826945 secs); 29 Sep 2019 16:01:45 -0000 X-Envelope-From: SRS0=wXM3=XY=yahoo.co.uk=okiddle@bounces.park01.gkg.net X-Qmail-Scanner-Mime-Attachments: | X-Qmail-Scanner-Zip-Files: | Received-SPF: pass (ns1.primenet.com.au: SPF record at bounces.park01.gkg.net designates 205.235.26.22 as permitted sender) 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=1569772859; bh=TrjTOyYKLGrqChV+N8RQEJPHIZMA/zNnk8A77/Wacdg=; h=From:References:To:Subject:Date:From:Sub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UH8IpMASyix6XXpJeHIKPEJuTdGD3Rl8 ax1jg7uKP.uwESvFlG.qNMUOJCuKutqKIglx_h_pVpFu6cvKXzT8h_Fg7q0HZP0hTbfUmmpYpq.C 4pNu5NJ9vaQephJM85Uf.5Nl3P_hI6zEOud0qDPtLAFogGNs8KEofRICRZt5UuEi16UlfBfZoKiy Z4BOP5MfkB424Q_uDStq31NOrxo2anIUSOgPUJOQpYiilfQDo0dlDBJ1MWkXSo7cWvpzdYfL3D2s 0hPemmezHOkpL_2DXmDMR25tBGQyThDI07j2M1hXLcZhT.DTJfnDP7wMxny4UuPRK5BMAkFwnIZ_ mNrleRRuaMWAcKO4HrRGI.ddDZ.lNQD5JPj30v79lBVh6Ke25eHUIX2wfvJLGVAkitPrfkH9wTox zHxwwGr6M.gkUkVBT1O2fD1QEf99TEHWc66sLpr42mdYKlleQ9VCrkEDppo_hIwJgqjCyt.NfGgZ BQgDasGQe0c0Znqbw2tru_GTTvAUEtzrxqcxMBYFB.uEbxFKo5PKcV.CROxJc6O4p5nsQGbXBXCZ skYClZwXMHC_e In-reply-to: <08fda202-ce07-4ec7-907f-2dfae3a38215@www.fastmail.com> From: Oliver Kiddle References: <93184-1569577244.094968@Wtq1.Nz_l.UBa8> <08fda202-ce07-4ec7-907f-2dfae3a38215@www.fastmail.com> To: "Zsh workers" Subject: Re: PATCH: some repeatable options in completions MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <31108.1569772856.1@hydra> Content-Transfer-Encoding: quoted-printable Date: Sun, 29 Sep 2019 18:00:56 +0200 Message-ID: <31109-1569772856.311549@seAm.LCSw.e6-i> "Daniel Shahaf" wrote: > Oliver Kiddle wrote on Fri, 27 Sep 2019 09:40 +00:00: > > ssh, multiple -t options force tty allocation, even if ssh has no loca= l > > tty. So I'm not sure there's any meaning to specifying it more than > > twice but _arguments doesn't provide an easy way to indicate that. > > = > > (untested) How about: > > '(-t -tt)-T[disable pseudo-tty allocation]' \ > '(-T)-t[force pseudo-tty allocation]' \ > "(-T)-tt[force pseudo-tty allocation even if have no controllin= g tty]" \ There are some cases where we've used that form. The disadvantage is that it bloats the option/description listing. The shorter it is, the more chance you have of finding what you're looking for. And given that -tt will be rare from the command-line rather than a script, I'm reluctant to add it here in that form. Note that with that form, -tt should exclude -t and arguably also -t can exclude -tt. It is also possible to check whether we already have a -t on the command line and alter the description accordingly. As in the following patch. The pattern for this has limitations as a t might appear in an argument to another option. We don't have opt_args before _arguments has been called. I also noticed another case of unmarked repeatable options, this time in _dsh. Oliver diff --git a/Completion/Unix/Command/_ssh b/Completion/Unix/Command/_ssh index f8f4e0091..df1fe6ca8 100644 --- a/Completion/Unix/Command/_ssh +++ b/Completion/Unix/Command/_ssh @@ -4,7 +4,7 @@ = _ssh () { local curcontext=3D"$curcontext" state line expl suf ret=3D1 - local args common common_transfer algopt tmp p1 file cmn cmds sdesc + local args common common_transfer algopt tmp p1 file cmn cmds sdesc tde= sc typeset -A opt_args = common=3D( @@ -30,6 +30,7 @@ _ssh () { = case "$service" in ssh) + (( $+words[(r)-[^-]#t*] )) && tdesc=3D' even if there is no controlli= ng tty' _arguments -C -s \ '(-a)-A[enable forwarding of the authentication agent connection]' = \ '(-A)-a[disable forwarding of authentication agent connection]' \ @@ -60,7 +61,7 @@ _ssh () { '-Q+[query parameters]:query option:((cipher\:"supported symmetric = ciphers" cipher-auth\:"supported symmetric ciphers that support authentica= ted encryption" mac\:"supported message integrity codes" kex\:"key exchang= e algorithms" key\:"key types" key-cert\:"certificate key types" key-plain= \:"non-certificate key types" protocol-version\:"supported SSH protocol ve= rsions" sig\:"supported signature algorithms" help\:"show supported querie= s"))' \ '-s[invoke subsystem]' \ '(-t)-T[disable pseudo-tty allocation]' \ - '(-T)-t[force pseudo-tty allocation]' \ + "(-T)*-t[force pseudo-tty allocation${tdesc}]" \ '-V[show version number]' \ '(-q)*-v[verbose mode (multiple increase verbosity, up to 3)]' \ '-W+[forward standard input and output to host]:stdinout forward:->= hostport' \ diff --git a/Completion/Unix/Command/_dsh b/Completion/Unix/Command/_dsh index fc7680062..2486b23fd 100644 --- a/Completion/Unix/Command/_dsh +++ b/Completion/Unix/Command/_dsh @@ -10,10 +10,10 @@ _arguments -s -C -S \ '(-M --show-machine-names)'{-M,--show-machine-names}'[prepend the host = name on output]' \ '(-i --duplicate-input)'{-i,--duplicate-input}'[duplicate input given t= o dsh]' \ '(-b --bufsize)'{-b,--bufsize}'[change buffer size used in input duplic= ation]:buffer size for -i (bytes)' \ - '(-m --machine)'{-m,--machine}'[execute on machine]:machine:{_hosts || = _user_at_host}' \ + \*{-m,--machine}'[execute on machine]:machine:{_hosts || _user_at_host}= ' \ '(-n --num-topology)'{-n,--num-topology}'[how to divide the machines]:n= umber' \ '(-a --all)'{-a,--all}'[execute on all machines]' \ - '(-g --group)'{-g,--group}'[execute on group member]:groupname:->groups= ' \ + \*{-g,--group}'[execute on group member]:groupname:->groups' \ '(-f --file)'{-f,--file}'[use the file as list of machines]:file:_files= ' \ '(-r --remoteshell)'{-r,--remoteshell}'[execute using shell]:remote she= ll:(rsh ssh)' \ '(-o --remoteshellopt)'{-o,--remoteshellopt}'[option to give to remote = shell ]:option' \