From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-3.3 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,UNPARSEABLE_RELAY autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 30886 invoked from network); 14 Oct 2021 10:58:46 -0000 Received: from zero.zsh.org (2a02:898:31:0:48:4558:7a:7368) by inbox.vuxu.org with ESMTPUTF8; 14 Oct 2021 10:58:46 -0000 ARC-Seal: i=1; cv=none; a=rsa-sha256; d=zsh.org; s=rsa-20210803; t=1634209126; b=kaQZmddM68ONhqfSluLrYuxwg81mddDMPR+bOCa8IpT5BG8xWgW/8YkiwQH7iyDpnffS/W6WX5 SziBripvnNrhqoGPnypvJF7SebvQWo9PzacIEvUKKfpdtX5BdcnLcgOP/OQZxzqp47FlLbUCfR Eqlj2rS6XEyB2k8hpNVNgdVM43/kCjdVmFdTh5qw7JTAgAcnN0TFHaYymM1qWPXHP0kXPtkDkV WuYYWWGugvWbzxDQJPih8apwlXA5LTfEimbrYrOG+GNNBzfaeCEgqdqWkV0ki/2i2NBQKxOMvM dep5WndB1PO1EY6Cdff3BNED9hYrPIE6v2jJY5bJRAOomw==; ARC-Authentication-Results: i=1; zsh.org; iprev=pass (snd01002-bg.im.kddi.ne.jp) smtp.remote-ip=27.86.113.18; dmarc=none header.from=kba.biglobe.ne.jp; arc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed; d=zsh.org; s=rsa-20210803; t=1634209126; bh=0QEa3vG2ykjd1f40a/WHGEdJ0FKyduZ0/EIS29HQt8k=; h=List-Archive:List-Owner:List-Post:List-Unsubscribe:List-Subscribe:List-Help: List-Id:Sender:Message-ID:In-Reply-To:To:References:Date:Subject: MIME-Version:Content-Transfer-Encoding:Content-Type:From:DKIM-Signature; b=Cvgc7UvQfJB4Mz4ZHYZYkCi2Zx01UGVPCrtxDl5MDxiWhP08LEUoUEi/YD9WQLROcwlUxdf6nq f1dnHh0214101kFWW7wayo4Ho/JbIbE13GDHPlOhbM7mexYPU5U6wMBeP9jDtG69sSAbH8G1Vx S39GqCkAJcZle/MXP2jkepFaWxDOVErZzAgx0aj3EAeodsalbD4NBapPE62aCFhE8e3hWu6oQx u6u5YuTQ0Sh1eFKYcAtYlySVkWNRwN4O9rTyxRgelytMKJp9qWqII96Rgtld5ONKF9eycG2y8g ahc9Krfz9YzClKQz+sKxM0OGgTaYE8yc+om+V6Xz2U6UKQ==; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=zsh.org; s=rsa-20210803; h=List-Archive:List-Owner:List-Post:List-Unsubscribe: List-Subscribe:List-Help:List-Id:Sender:Message-Id:In-Reply-To:To:References: Date:Subject:Mime-Version:Content-Transfer-Encoding:Content-Type:From: Reply-To:Cc:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID; bh=V97QoE9cq1FwGWdAy7GXb6RuY0+NHw9RdIRGB6LR+y4=; b=gqAIj3KX5eKt76+Mbwm5bJ+O7x 7RbOgkiR8MZsZ4+Ks+4ccT7hn8P1gxmHRLXp+4oSTVJhwB9g8+ibEzX+H0skH1wQ1GmGYeHhEiUqO HPxNZA/I3VvJIAJLMvK4w3+++p51R54JbnY/5HyvCyrZsgZoIsSi/mPO4DCt8hbml01E/E+BrdboR mq37MYsRmhFfJjEoDwFa/9JyJ+aszd91q0s1K96IzbEBtJSMWOf/nw1EIBFJSL3dFA5Yi4c7At7SV lofQ0J9AD/7LmdaWZA8o958bRD7Q9CxM+cjCdIxWq3oCWrZoctwKLCJcimlAEI6c16eC0sJcWJ7hM DhPZoR3g==; Received: from authenticated user by zero.zsh.org with local id 1mayRf-000FR2-JE; Thu, 14 Oct 2021 10:58:43 +0000 Authentication-Results: zsh.org; iprev=pass (snd01002-bg.im.kddi.ne.jp) smtp.remote-ip=27.86.113.18; dmarc=none header.from=kba.biglobe.ne.jp; arc=none Received: from snd01002-bg.im.kddi.ne.jp ([27.86.113.18]:32257 helo=dfmta1016.biglobe.ne.jp) by zero.zsh.org with esmtps (TLS1.3:TLS_AES_256_GCM_SHA384:256) id 1mayRM-000F7F-LR; Thu, 14 Oct 2021 10:58:26 +0000 Received: from mail.biglobe.ne.jp by omta1016.biglobe.ne.jp with ESMTP id <20211014105818046.CTLL.85532.mail.biglobe.ne.jp@biglobe.ne.jp> for ; Thu, 14 Oct 2021 19:58:18 +0900 From: Jun T Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Mime-Version: 1.0 (Mac OS X Mail 12.4 \(3445.104.21\)) Subject: Re: How about separating "_arguments --" into a new function? Date: Thu, 14 Oct 2021 19:58:17 +0900 References: <4B74EF96-AE73-4D40-ACDD-9999DFFDA1A8@kba.biglobe.ne.jp> <20211012160428.GD17948@tarpaulin.shahaf.local2> To: zsh-workers@zsh.org In-Reply-To: <20211012160428.GD17948@tarpaulin.shahaf.local2> Message-Id: X-Mailer: Apple Mail (2.3445.104.21) X-Biglobe-Sender: takimoto-j@kba.biglobe.ne.jp X-Seq: 49486 Archived-At: X-Loop: zsh-workers@zsh.org Errors-To: zsh-workers-owner@zsh.org Precedence: list Precedence: bulk Sender: zsh-workers-request@zsh.org X-no-archive: yes List-Id: List-Help: List-Subscribe: List-Unsubscribe: List-Post: List-Owner: List-Archive: > 2021/10/13 1:04, Daniel Shahaf wrote: >=20 > perhaps the tool could be designed with an eye towards updating = existing > completion functions? For instance, perhaps the tool could inspect = the > existing _cmd file and omit from the output any lines where the > --foo[lorem ipsum] part already appears in the file? Such a tool is useful, of cause, but analyzing the existing _cmd is would be quite complicated, I guess. > Perhaps make the tool a filter, in order to support, say, =C2=ABssh = foo > 'lorem --help' | help2specs=C2=BB? Of course it must read the help text from stdin (if cmd is not given as argument) since in _arguments 'cmd --help' is run by _call_program and the output is passed to help2specs via pipe. >> Or just using $_args_cache_cmd is enough? >=20 > If it is enough, then it should be made more discoverable. I guess it is enough since no one is requesting to separate _arguments. How about the following? diff --git a/Doc/Zsh/compsys.yo b/Doc/Zsh/compsys.yo index 89b918d60..c00270f3d 100644 --- a/Doc/Zsh/compsys.yo +++ b/Doc/Zsh/compsys.yo @@ -4237,6 +4237,17 @@ as `tt(-)tt(-enable-foo)', but the script also = accepts the negated form =20 example(_arguments -- -s "LPAR()(#s)--enable- --disable-RPAR()") =20 +The list of var(spec)s derived from the help text is saved in an array +parameter `tt(_arg_cache_)var(cmd)' where `var(cmd)' is the name of the +command. If `tt(_arguments -)tt(-)' (or tt(_gnu_generic)) does not = work +satisfactorily for a commnd `tt(foo)', you can save the specs in a file +`tt(_foo)' by + +example(echo ${(qqq)_arg_chache_foo} > _foo) + +and use it as a draft of your own completion function for the command +`tt(foo)'. + em(Miscellaneous notes) =20 Finally, note that tt(_arguments) generally expects to be the primary