From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 18258 invoked by alias); 29 Jun 2011 21:18:39 -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: X-Seq: 29522 Received: (qmail 2046 invoked from network); 29 Jun 2011 21:18:37 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_NONE, SPF_HELO_PASS autolearn=ham version=3.3.1 Received-SPF: none (ns1.primenet.com.au: domain at bewatermyfriend.org does not designate permitted sender hosts) From: Frank Terbeck To: zsh workers Cc: Nikolai Weibull , Mikael Magnusson Subject: Re: PATCH: (2/3) _git: Pick up addon completions from $fpath In-Reply-To: <1309379833-31315-3-git-send-email-ft@bewatermyfriend.org> (Frank Terbeck's message of "Wed, 29 Jun 2011 22:37:12 +0200") References: <1309211717-9650-1-git-send-email-ft@bewatermyfriend.org> <1309379833-31315-1-git-send-email-ft@bewatermyfriend.org> <1309379833-31315-3-git-send-email-ft@bewatermyfriend.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.2 (gnu/linux) Date: Wed, 29 Jun 2011 23:15:06 +0200 Message-ID: <87iprouyp1.fsf@ft.bewatermyfriend.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Df-Sender: 430444 Frank Terbeck wrote: > + _describe -t third-party-addons 'third party addon' _git_third_party && ret=0 Actually, just because the completion is there doesn't mean that completing the thing at "git " makes sense, because the addon program may not even be installed on the system in question. For example, we're already shipping `_git-buildpackage'. But on a system where `git-buildpackage' is not installed, I wouldn't want it to appear in suggestions for "git b". Here's something on top of the previous patch to take such situations into account. I'd squash these two, before committing to CVS. Regards, Frank diff --git a/Completion/Unix/Command/_git b/Completion/Unix/Command/_git index 4567460..a1856df 100644 --- a/Completion/Unix/Command/_git +++ b/Completion/Unix/Command/_git @@ -4606,7 +4606,12 @@ _git_commands () { _describe -t plumbing-sync-commands 'plumbing sync command' plumbing_sync_commands && ret=0 _describe -t plumbing-sync-helper-commands 'plumbing sync helper command' plumbing_sync_helper_commands && ret=0 _describe -t plumbing-internal-helper-commands 'plumbing internal helper command' plumbing_internal_helper_commands && ret=0 - _describe -t third-party-addons 'third party addon' _git_third_party && ret=0 + local -a addons + local a + for a in $_git_third_party; do + (( ${+commands[git-${a%%:*}]} )) && addons+=( $a ) + done + _describe -t third-party-addons 'third party addon' addons && ret=0 _describe -t user-specific-commands 'user specific command' user_commands && ret=0 return ret }