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.4 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,UNPARSEABLE_RELAY autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 20260 invoked from network); 1 Apr 2021 17:33:29 -0000 Received: from zero.zsh.org (2a02:898:31:0:48:4558:7a:7368) by inbox.vuxu.org with ESMTPUTF8; 1 Apr 2021 17:33:29 -0000 ARC-Seal: i=1; cv=none; a=rsa-sha256; d=zsh.org; s=rsa-20200801; t=1617298409; b=oq6ARmUzGfqCh4mfPhHF69islNsntp8MVYCqJ0lMvtfqry2ZvvRUVv7dKZ5Pmj7F3NrtSCE2Ag DLDhlyAZkjTT0BpyQ9WsYNDVBIQZW9l9YRAEuZ32BpQxG9SlbBzYBQoI83nlla4UYIorVB/fLf scrFS/FzFEt+t7PtK0Alg0ZLCl+DXRwi9KAbNaXcH9dUeW5vvHrvwyahzwFMb58FAAHl1G+ToG pzTu36F6KN2FGqFyfhJNPMiMHVAn1kH2DwuEBM2qCNDPcq/wc3xYh++C4LYaapRkUUoTy2FuPn fb5+H9tWhOgioOSwf4s2O9kTixgiZb9UP+t51fQXm/kvWw==; ARC-Authentication-Results: i=1; zsh.org; iprev=pass (out4-smtp.messagingengine.com) smtp.remote-ip=66.111.4.28; dkim=pass header.d=daniel.shahaf.name header.s=fm3 header.a=rsa-sha256; dkim=pass header.d=messagingengine.com header.s=fm2 header.a=rsa-sha256; dmarc=none header.from=daniel.shahaf.name; arc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed; d=zsh.org; s=rsa-20200801; t=1617298409; bh=/kqVQSbacrIEuUJxi9Gca56qHixxjeTVvuKxNDT2alE=; h=List-Archive:List-Owner:List-Post:List-Unsubscribe:List-Subscribe:List-Help: List-Id:Sender:In-Reply-To:Content-Transfer-Encoding:Content-Type: MIME-Version:References:Message-ID:Subject:To:From:Date:DKIM-Signature: DKIM-Signature:DKIM-Signature; b=du3RcUSIe0uG643IWtf6L+1ej//Yj1nzreSYEhtnUt/B8oSJlbzpw9TuzUITrN8dq7cdMLDyr4 sbEqoLdtqzIr2qfiDsvng4S7EdWQsUkaWtl7CgYNRITDXEM/CnpR1F8pmiUf+8VqkqvGkkCVJ8 z0ds0FjQHBm7IdQCGsUAdmrUAgnHfoY+AZnXyJbc0WvDMGWYuomne53pIbZYSno9ipjB8v2JOJ +7BjL9BC/lOkJec4XqRQcKoJor6eIeqbbKkT2OhGTQsf9OgMiBLI4I7Xtn7Xt0uQmr0qESRv5p npnJY+aaQ8WDCQw8wr2/ixqwRZTupJw4XIx3cqlwKXYIwg==; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=zsh.org; s=rsa-20200801; h=List-Archive:List-Owner:List-Post:List-Unsubscribe: List-Subscribe:List-Help:List-Id:Sender:In-Reply-To:Content-Transfer-Encoding :Content-Type:MIME-Version:References:Message-ID:Subject:To:From:Date: Reply-To:Cc:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID; bh=J8Te3nnBSUdORlw6QayaMQz4QwnJWvJriSAlprblaCA=; b=m4ungzFZncoADYl9t+b0kYabKh jwLhuUaZrzgAfvkyw2yjTLRAfGch4TScf4JUZmdIlCijggCp9QuSb/aV/XzOinB+H2pkRqEZYHDNH EJBmEFRT7U3graFkd+FO3IIHB75W+XYSeVm6D+/TpjATmJ7c4wj7CvlwaILs5/Ruo6wbkFCAY9D64 Rxij/pPDVljxudF+Q1/sChK6XKSyB2TuRSUC9UK4snMzzDk8x2HKQNOMlFWwS0NS53mx1450BEg1f v7BXsDzJwwKus8Cgbwp7iXwfUFPuzCvswINNYU5mse3EynTG1yo8/CeJ+3NE5gMteVrTjWOT3sRLT VKduQaLA==; Received: from authenticated user by zero.zsh.org with local id 1lS1CC-000LlP-KP; Thu, 01 Apr 2021 17:33:28 +0000 Authentication-Results: zsh.org; iprev=pass (out4-smtp.messagingengine.com) smtp.remote-ip=66.111.4.28; dkim=pass header.d=daniel.shahaf.name header.s=fm3 header.a=rsa-sha256; dkim=pass header.d=messagingengine.com header.s=fm2 header.a=rsa-sha256; dmarc=none header.from=daniel.shahaf.name; arc=none Received: from out4-smtp.messagingengine.com ([66.111.4.28]:35559) by zero.zsh.org with esmtps (TLS1.3:TLS_AES_256_GCM_SHA384:256) id 1lS1Bu-000LYL-AC; Thu, 01 Apr 2021 17:33:11 +0000 Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailout.nyi.internal (Postfix) with ESMTP id 0282E5C00AC; Thu, 1 Apr 2021 13:33:09 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute3.internal (MEProxy); Thu, 01 Apr 2021 13:33:09 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= daniel.shahaf.name; h=date:from:to:subject:message-id:references :mime-version:content-type:content-transfer-encoding :in-reply-to; s=fm3; bh=J8Te3nnBSUdORlw6QayaMQz4QwnJWvJriSAlprbl aCA=; b=YMZPNIe+/VLEZTH09NvZ/DB0RtzIwjSeXSKxQC/Q5fWhC75vRX/axQ/f ZG8SHfFN2WaV4QQQSc7bdyjYIQKIKpAeahGY6PpWghACh+4XxY88K4EesAIWysj+ lTzcEQ+3g0bbDtxT3c7nKHByTxdgh+7am4jwXv/rBuZqGLyEhSqMjGKYbAihs8+q K9dyY/DdKoX38F9pKJW/BBvrcqz3L0wFBrOZWtZHakTLrv1yBJUIVbBUq5tJk8Tc J8mdFUg9JhF5aFsBWEV7Fmum5gxdu3BByYJ8bnNDh8LN4GywSi5in9jloW0mvRuj WYxeMSL0v1CEC7FcMkUhnCBuCuq4lA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm2; bh=J8Te3nnBSUdORlw6QayaMQz4QwnJWvJriSAlprbla CA=; b=iwFA476oot7gmIllYG1oADe+7F8ImQzbUc5gzXwOhXxwXP+MnNpB8PQRx y2QoyqHChiepEyjerOSSMGOgdlOzDXZ8HXMHy+Dk2AJGkZgFJ/ildcDn6hJX6gR0 Pi8dj6xiP9babhYYXgiKKpBLBV1Qx24Rjj/5S1FdYPYMBtrZVpRNNDlKpybKBbjc LKyhUHj+CcUZbsqiQcnTMxAwXR4lR56/FMw7FUvOKfvhX93OuFMJJlWwZ2Uj3LwX b0sAirOgADNBTAHOVm/zC5Ro0MgMohsmIQIKIoHFrq9Rsf8O6XZ4Aip0iAlbE87I Tnta3+xZZSQqU7e1+UyQ+fdLxjmEQ== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduledrudeigedguddtgecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd enucfjughrpeffhffvuffkfhggtggugfgjfgesthektddttderudenucfhrhhomhepffgr nhhivghlucfuhhgrhhgrfhcuoegurdhssegurghnihgvlhdrshhhrghhrghfrdhnrghmvg eqnecuggftrfgrthhtvghrnhepgfelhedtffeuhfegueelfeffjeegtddtleehvddvueei hfevgfdvgffhvedvkeetnecukfhppeejledrudekvddrfeeirddukedunecuvehluhhsth gvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepugdrshesuggrnhhivghl rdhshhgrhhgrfhdrnhgrmhgv X-ME-Proxy: Received: from tarpaulin.shahaf.local2 (bzq-79-182-36-181.red.bezeqint.net [79.182.36.181]) by mail.messagingengine.com (Postfix) with ESMTPA id 5CA8B24005E for ; Thu, 1 Apr 2021 13:33:08 -0400 (EDT) Received: by tarpaulin.shahaf.local2 (Postfix, from userid 1005) id 4FB9J12nKLz29V; Thu, 1 Apr 2021 17:33:05 +0000 (UTC) Date: Thu, 1 Apr 2021 17:33:05 +0000 From: Daniel Shahaf To: Zsh workers Subject: Re: [PATCH 1/2] __arguments: New completion function for _arguments. Message-ID: <20210401173305.GB11180@tarpaulin.shahaf.local2> References: <20210401000026.23570-1-danielsh@tarpaulin.shahaf.local2> <96182-1617281582.024669@4LIl.h-KW.lXZv> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <96182-1617281582.024669@4LIl.h-KW.lXZv> User-Agent: Mutt/1.10.1 (2018-07-13) X-Seq: 48370 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: Archived-At: Oliver Kiddle wrote on Thu, Apr 01, 2021 at 14:53:02 +0200: > You wrote: > > +++ b/Completion/Zsh/Function/__arguments > > It occurs to me that if completion for completion functions is a useful > thing, Well, I do look up compadd and _arguments' options in the manual somewhat frequently. That's what gave me the idea of the 1/2 patch in the first place. > _compadd could define a pattern to complete compadd options for > all commands named _*. That might be useful for writing completion functions at the prompt. Of course, it's not needed for the "jog one's memory" use-case, since in that case one can just do «compadd -». > And with your __ convention, _nothing could specify a pattern for > completion of completions for completions. To make this work, presumably compadd would want to register itself not for «_*» but for «_[^_]*» (glob, not regexp), so the patterns don't overlap. Whether it's a good idea to default __* functions to be completed by _nothing I don't have an intuition for, yet. > I'm not fond of _git's use of an initial __ on it's private functions > rather than just _git_... (or _git-... for subcommands). We should > perhaps decide and then document the convention. _git didn't exactly invent this. Using single or double leading underscores for private symbols is standard this way is standard or idiomatic in other languages too. > I don't know whether you were planning to push this I was/am. > or if it only served as setup for your follow-up but I'll just make a > few, um, arguments: > > > + _arguments -A '-*' : \ > > This is a rare case where the parameter to -A needs to be more > complicated than just '-*'. Hmm. How about «-A '-*|:|(!|)\(*'»? > I'd actually be inclined to use _regex_arguments for this function. > Would allow specs to be broken up. Could we leave this for future work? Not to let the perfect be the enemy of the good, etc.. > > + '-n[set $NORMARG]' \ > > -n should not be used, it is fundamentally broken and will never be > fixed because the right answer to $NORMARG as it is defined can be a > list of possibilities. It grabs an internal variable from the first > element of a linked-list and dumps it out. The problem it was added to > solve would have had better solutions. > > Could hide it with ! or add a comment. > I'll add !, and we should document that in the manual too if it isn't already. > > + "-C[modify \$curcontext for \`->action' (requires \`local curcontext')]" \ > > This is instead of the $context array. > Should only be used where multiple valid states is not a possibility. There isn't room to say all this inside the brackets. > I fear that the note in parentheses implies just `local curcontext' and > not local curcontext="$curcontext" is needed. Good point. How about deleting the parenthetical? Or replacing it by "(see manual)"? > > + "-R[when \`->action' matches, return 300]" \ > > I don't think that really gets used much [[ -n $state ]] is more > readable. How does this affect the patch? Are you suggesting to hide (with «!») this too? > > + "-M[specify matchspec for completing option names and values]:matchspec for completing option names and values (default\\: 'r\\:|[_-]=* r\\:|=*')" \ > > The convention widely used elsewhere is to represent defaults in square > brackets without any `default: ' tag. > I'll make it so. > _description does have mostly unused features for more custom > formatting. We perhaps ought to consider whether this could be better > used for units, defaults, examples, maximums and minimums so that this > is under the control of the user. Sounds like a question for a new thread. > > + '*:spec (e.g., "*(-t --to)"{-t+,--to=}"[specify recipient]\:recipient'\''s address\:_email_addresses)' > > In your example, the * needs to come after the exclusion list. ! for > ignored options comes before. Good catch; will fix. Thanks for the review, Daniel