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 20036 invoked from network); 1 Apr 2021 12:53:20 -0000 Received: from zero.zsh.org (2a02:898:31:0:48:4558:7a:7368) by inbox.vuxu.org with ESMTPUTF8; 1 Apr 2021 12:53:20 -0000 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:Message-ID:Date:Content-ID: Content-Type:MIME-Version:Subject:To:References:From:In-reply-to:Reply-To:Cc: Content-Transfer-Encoding:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID; bh=TQO5o95ybuMeT6MeP9Xl1P8CQiSqQ7fjaEExUYQwekI=; b=ujUq5oELLntJda/mnaRhWRmk9Q 86eyyNxAGGkXeXutL8HoYtbMC3FuzliURdnrOg1b9ZpFN03qp468/1J0tK71g6uB6CaQ+lP3dFtpn 2XY6ZK7yWCLYA2aM2Ef2M4u5lppUUYkjdVwoZNDgZaKihvVvVRXoOckkNT992e5eVJKPIZVzaiot+ qM5DC1KpdPmF5OEAhEf4fKDeQqAj1AqwMiNiZSKZq3ZiJ15KSb2Uqft91gUfszcGz04UrPjErArF0 XeTCoUptsTp2a/Sbb3gXf/le8NgVUAaljdStRrb+YKp7q18XRkxRy/feGq0+XkxI4Q3OKfGSu3JNq p2ayOsEA==; Received: from authenticated user by zero.zsh.org with local id 1lRwp5-000ERl-2j; Thu, 01 Apr 2021 12:53:19 +0000 Received: from authenticated user by zero.zsh.org with esmtpsa (TLS1.3:TLS_AES_256_GCM_SHA384:256) id 1lRwop-000EIt-Oc; Thu, 01 Apr 2021 12:53:03 +0000 Received: from [192.168.178.21] (helo=hydra) by mail.kiddle.eu with esmtp(Exim 4.93.0.4) (envelope-from ) id 1lRwoo-000P1L-0s for zsh-workers@zsh.org; Thu, 01 Apr 2021 14:53:02 +0200 In-reply-to: <20210401000026.23570-1-danielsh@tarpaulin.shahaf.local2> From: Oliver Kiddle References: <20210401000026.23570-1-danielsh@tarpaulin.shahaf.local2> To: Zsh workers Subject: Re: [PATCH 1/2] __arguments: New completion function for _arguments. MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <96181.1617281582.1@hydra> Date: Thu, 01 Apr 2021 14:53:02 +0200 Message-ID: <96182-1617281582.024669@4LIl.h-KW.lXZv> X-Seq: 48368 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: You wrote: > +++ b/Completion/Zsh/Function/__arguments It occurs to me that if completion for completion functions is a useful thing, _compadd could define a pattern to complete compadd options for all commands named _*. And with your __ convention, _nothing could specify a pattern for completion of completions for completions. 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. I don't know whether you were planning to push this 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 '-*'. I'd actually be inclined to use _regex_arguments for this function. Would allow specs to be broken up. > + '-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. > + "-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. I fear that the note in parentheses implies just `local curcontext' and not local curcontext="$curcontext" is needed. > + "-R[when \`->action' matches, return 300]" \ I don't think that really gets used much [[ -n $state ]] is more readable. > + "-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. _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. > + '*: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. Oliver