From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 15640 invoked from network); 7 Sep 1999 11:51:24 -0000 Received: from sunsite.auc.dk (130.225.51.30) by ns1.primenet.com.au with SMTP; 7 Sep 1999 11:51:24 -0000 Received: (qmail 10477 invoked by alias); 7 Sep 1999 11:51:14 -0000 Mailing-List: contact zsh-workers-help@sunsite.auc.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 7689 Received: (qmail 10470 invoked from network); 7 Sep 1999 11:51:14 -0000 Date: Tue, 7 Sep 1999 13:51:04 +0200 (MET DST) Message-Id: <199909071151.NAA04195@beta.informatik.hu-berlin.de> From: Sven Wischnowsky To: zsh-workers@sunsite.auc.dk In-reply-to: Sven Wischnowsky's message of Tue, 7 Sep 1999 13:22:08 +0200 (MET DST) Subject: Re: PATCH: Completion/User/_cvs again. I wrote: > Tanaka Akira wrote: > > > I think the style of `_rpm' is useful for state machines. But it > > cannot represent function call. And `_cvs' has such functions. > > > > For example, `_cvs_extract_directory_entries' is called from > > `_cvs_setup_allentries', `_cvs_setup_direntries' and > > `_cvs_setup_modentries'. And it should return to its caller. > > This is hard to implement in state machine style, I think. > > Ah, I see. Sorry. > > Yes, adding a heap of extra states a la `extract_file_or_directory_entry' > is ugly. > > Hm, some form of `case' that executes all matching branches would be > useful here. > > (Yes, I know that one can do that e.g. with a `case' in a loop where > the case branches remove substrings from the `state' name, but that > isn't exactly a nice solution, either.) I always forget things... Of course, one can also do (in file `_foo'): #compdef foo local state lstate ret=1 if (( $# )); then state="$1" else _arguments '...:->bar' ... && ret=0 fi while [[ -n "$state" ]]; do lstate="$state" state='' case "$lstate" in bar) # include completions for state `baz' and `foobar' _foo baz && ret=0 _foo foobar && ret=0 # this could also be `state=foobar' ;; baz) ... ;; foobar) ...;; esac done return ret Don't know if that is cleaner than your solution, though. Bye Sven -- Sven Wischnowsky wischnow@informatik.hu-berlin.de