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 19306 invoked from network); 19 Mar 2021 02:41:23 -0000 Received: from zero.zsh.org (2a02:898:31:0:48:4558:7a:7368) by inbox.vuxu.org with ESMTPUTF8; 19 Mar 2021 02:41:23 -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:cc:Reply-To: Content-Transfer-Encoding:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID; bh=er8QbARZxfz1DDUMO5qZTZhgspf+A9HH23RXvjXTzlw=; b=SyYrFzHqNhiVskkUfwk2CjUMh7 3kwEXiZxUhjn+6RthQKG4xspoA9xLDMHrC3V6OCDRPvFNCRe776Z6eNNJlv8lK8/SCU7EURUgtrVU 6IZgkf61HsOOcnOq/N7j7U0tkE3pMq3aCIsxsb+f7fgwU4YXrH/bavNd3eUEQubzf+CnLVjMMfuO6 JjIxiZP5gQERnYcQUb2DZ9WL3sGu0PFtdz6TxK3+yyOajlarXso88nP1Pp6+TrnaAXwGeaXgxX80Q 0kHsjx2LJv0J3IHxU9ZF+mrnYwP2P7q4ZqeUWNd1h+ZbdcP+nBsoD2Jlq3cle0VXPKDC/j6LqqoQB aShOGbTQ==; Received: from authenticated user by zero.zsh.org with local id 1lN54g-0002ew-S8; Fri, 19 Mar 2021 02:41:18 +0000 Received: from authenticated user by zero.zsh.org with esmtpsa (TLS1.3:TLS_AES_256_GCM_SHA384:256) id 1lN54B-0002IU-8B; Fri, 19 Mar 2021 02:40:47 +0000 Received: from [192.168.178.21] (helo=hydra) by mail.kiddle.eu with esmtp(Exim 4.93.0.4) (envelope-from ) id 1lN54A-0005F9-Af; Fri, 19 Mar 2021 03:40:46 +0100 cc: zsh-users@zsh.org In-reply-to: From: Oliver Kiddle References: To: Phil Pennock Subject: Re: _values with controllable duplicates suppression? MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <20157.1616121646.1@hydra> Date: Fri, 19 Mar 2021 03:40:46 +0100 Message-ID: <20158-1616121646.327823@nVvU.T9s4.XE9v> X-Seq: 26581 Archived-At: X-Loop: zsh-users@zsh.org Errors-To: zsh-users-owner@zsh.org Precedence: list Precedence: bulk Sender: zsh-users-request@zsh.org X-no-archive: yes List-Id: List-Help: List-Subscribe: List-Unsubscribe: List-Post: List-Owner: List-Archive: Archived-At: Phil Pennock wrote: > I really like the way that `_values -w` means that if I have already put > a given repo onto the command-line, it's not offered again. I wouldn't use _values just for that feature. Try passing -F words (or -F line if using _arguments) to compadd. > My problem is that sometimes there's an organization with the same name > as one of the repos inside that organization. Eg, "foo/foo" as well as > "foo/bar", "foo/baz", so if I do: > > git grab -o foo > > then the "foo" result is suppressed because `_values -w` sees that `foo` > is already on the command-line, and I'm only offered `bar` and `baz`. It is ignoring the contents of the $words array so you can manipulate that (plus $CURRENT) to only cover the final arguments. Actually, it is probably using $words[2,-1]. You can use two colons after the asterisk in the _arguments spec to strip down the words array: '*::repo:_github_repos_for' You may be better off with '*:::repo:= _github_repos_for' actually. Depends how many normal arguments there are. That sets $words to only those covered by this spec and then the = makes it add a fake one for the command-position. Oliver