From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 22746 invoked from network); 15 Mar 2006 22:06:20 -0000 X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-2.5 required=5.0 tests=BAYES_00,FORGED_RCVD_HELO autolearn=ham version=3.1.0 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by ns1.primenet.com.au with SMTP; 15 Mar 2006 22:06:20 -0000 Received: (qmail 71096 invoked from network); 15 Mar 2006 22:06:13 -0000 Received: from sunsite.dk (130.225.247.90) by a.mx.sunsite.dk with SMTP; 15 Mar 2006 22:06:13 -0000 Received: (qmail 17763 invoked by alias); 15 Mar 2006 22:06:06 -0000 Mailing-List: contact zsh-users-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 10030 Received: (qmail 17753 invoked from network); 15 Mar 2006 22:06:05 -0000 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by sunsite.dk with SMTP; 15 Mar 2006 22:06:05 -0000 Received: (qmail 69949 invoked from network); 15 Mar 2006 22:06:05 -0000 Received: from xproxy.gmail.com (66.249.82.202) by a.mx.sunsite.dk with SMTP; 15 Mar 2006 22:06:05 -0000 Received: by xproxy.gmail.com with SMTP id h28so195443wxd for ; Wed, 15 Mar 2006 14:06:03 -0800 (PST) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:sender:to:subject:mime-version:content-type:content-transfer-encoding:content-disposition; b=LfrOMwSlQYrUnJ6Z19NM1dSH3e2oFItkIb4fcFu8ogDUpK0qiMGRYiWx7Yk4hwgWzij7Wmss5Daj5NOzW7qH+KOjQ0rPQvjG1QAiYZvwEKN7YxnjFvk4fnCWoidcX1BjXQX1yY7gWbcmgDl90Ssw5hxpRWeRKb50NICmpkIhfeo= Received: by 10.70.7.9 with SMTP id 9mr1173929wxg; Wed, 15 Mar 2006 14:06:03 -0800 (PST) Received: by 10.70.39.9 with HTTP; Wed, 15 Mar 2006 14:06:03 -0800 (PST) Message-ID: Date: Wed, 15 Mar 2006 23:06:03 +0100 From: "Nikolai Weibull" Sender: nikolai.weibull@gmail.com To: "Zsh Users" Subject: How to solve completion of "git command" and "git-command" MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Currently, _git completes both ways of invoking git and it's subcommands: if [[ $words[1] =3D=3D git ]]; then if (( CURRENT =3D=3D 2 )); then _git_commands else shift words (( CURRENT-- )) curcontext=3D"${curcontext%:*:*}:git-$words[1]:" _call_function ret _git-$words[1] fi else _call_function ret _$words[1] fi However, the "git" command now also takes options, not just subcommands as its argument. How do I best solve this, so that I can still get the functionality implied in the example above (just calling the correct function, e.g., _git-commit for both "git commit ..." and "git-commit ...")? The "git" command currently takes three options: "--version", "--help", and "--exec-path[=3DPATH]". The _git_commands function currently invokes _describe: _describe -t commands 'git command' commands && ret=3D0 on an array of commands-descriptions. I was thinking that something like if [[ $words[1] =3D=3D git ]]; then local context state line typeset -A opt_args _arguments \ '(- :)--version[display version information]' \ '(- :)--help[display help]' \ '--exec-path=3D-[execution path for git]:directory:_directories' \ ':command:->command' \ '*::options:->options' && ret=3D0 case $state in (command) _git_commands ;; (options) curcontext=3D"${curcontext%:*:*}:git-$words[1]:" _call_function ret _git-$words[1] ;; esac else _call_function ret _$words[1] fi might work, but I want to make seru that I'm not missing something here? Any help towards reaching a satisfactory solution will be greatly appreciat= ed. Thanks. nikolai