From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 14163 invoked from network); 21 Jul 2003 22:48:10 -0000 Received: from sunsite.dk (130.225.247.90) by ns1.primenet.com.au with SMTP; 21 Jul 2003 22:48:10 -0000 Received: (qmail 14601 invoked by alias); 21 Jul 2003 22:48:05 -0000 Mailing-List: contact zsh-workers-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 18882 Received: (qmail 14588 invoked from network); 21 Jul 2003 22:48:04 -0000 Received: from localhost (HELO sunsite.dk) (127.0.0.1) by localhost with SMTP; 21 Jul 2003 22:48:04 -0000 X-MessageWall-Score: 0 (sunsite.dk) Received: from [216.254.112.142] by sunsite.dk (MessageWall 1.0.8) with SMTP; 21 Jul 2003 22:48:4 -0000 Received: by acolyte.scowler.net (Postfix, from userid 1000) id 151147001E; Mon, 21 Jul 2003 18:48:03 -0400 (EDT) Date: Mon, 21 Jul 2003 18:48:02 -0400 From: Clint Adams To: kfogel@collab.net Cc: dev@subversion.tigris.org, zsh-workers@sunsite.dk Subject: Re: subversion and programmable completion Message-ID: <20030721224802.GA7569@acolyte.scowler.net> Mail-Followup-To: Clint Adams , kfogel@collab.net, dev@subversion.tigris.org, zsh-workers@sunsite.dk References: <20030720162723.GA26506@acolyte.scowler.net> <85fzkznc6y.fsf@newton.ch.collab.net> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <85fzkznc6y.fsf@newton.ch.collab.net> User-Agent: Mutt/1.5.4i > What's not machine parseable about the current output? The zsh completion function basically does the following: To find out what subcommands are available, run 'svn help', and grab everything between 'Available subcommands:' and 'Subversion is a tool for revision control.' Subcommands listed in parentheses are aliases to the word before the parentheses. For subcommands, run 'svn help ', grab the 'usage:' line, check for the presence of 'URL' or 'PATH' on that line, and try to complete URLs or files and directories, respectively, as well as the options listed after 'Valid options:' (where options in brackets are aliases to the options outside). There is a similar process for svnadmin. There are several problems with this scheme: It doesn't handle multiple usage possibilities. For example, usage: switch URL [PATH] or switch --relocate FROM TO [PATH ... ] usage: 1. diff [-r N[:M]] [--old OLD-TGT] [--new NEW-TGT] [PATH ...] 2. diff -r N:M URL 3. diff [-r N[:M]] URL1[@N] URL2[@M] This could be solved with some more intelligent parsing. It doesn't handle know whether or not PATH refers to files in the repository (as in svn diff), files not yet in the repository (as in svn add), or something else. This could be solved with some hardcoding in the completion function. It doesn't know what 'arg' refers to in '-r arg', '--username arg', '--password arg', and so on. This could be solved with some hardcoding in the completion function. If the subversion help output ever is altered so that the heuristics fail, completion will break. None of this is a problem (other than lack of man-hours), but if svn were to actively participate in its own command completion, I think it would be more efficient and less error-prone.