From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 15539 invoked from network); 6 May 2000 08:20:20 -0000 Received: from sunsite.auc.dk (130.225.51.30) by ns1.primenet.com.au with SMTP; 6 May 2000 08:20:20 -0000 Received: (qmail 10995 invoked by alias); 6 May 2000 08:20:15 -0000 Mailing-List: contact zsh-workers-help@sunsite.auc.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 11226 Received: (qmail 10980 invoked from network); 6 May 2000 08:20:15 -0000 Subject: Re: PATCH: Re: sudo completion problem In-Reply-To: <000501bfb728$30dd2f40$21c9ca95@mow.siemens.ru> from Andrej Borsenkow at "May 6, 2000 10:56:23 am" To: Andrej Borsenkow Date: Sat, 6 May 2000 09:19:54 +0100 (BST) CC: Sven Wischnowsky , zsh-workers@sunsite.auc.dk X-Mailer: ELM [version 2.4ME+ PL66 (25)] MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Message-Id: From: Zefram Andrej Borsenkow wrote: >The weird is, that *long* options (at least in this case) are >interpreted everywhere: Actually it's all options, it's the evil GNU getopt's default behaviour (it can be turned off by putting a "+" at the start of the option string). $ ls --version ls (GNU fileutils) 4.0l Written by Richard Stallman and David MacKenzie. Copyright (C) 1999 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. $ ls . -l total 5 drwx------ 17 zefram fysh 1024 Mar 30 15:13 etc drwxr-xr-x 5 zefram fysh 1024 Mar 8 14:07 pub drwxr-xr-x 6 zefram fysh 1024 Apr 3 18:58 public_html drwx------ 3 zefram fysh 1024 May 6 09:10 tmp drwx------ 11 zefram fysh 1024 Mar 8 14:10 usr If we can determine that a particular command is processing options in this way, it would be nice to complet options accordingly. However, by default options should only be completed before the first non-option argument. In either case, options should never be completed after a "--". I envision _arguments first of all deciding whether the command allows options everywhere or not. This should be under the control of the caller, via options to _arguments; possible values are "everywhere", "only before first argument", "autodetect GNU getopt" (if possible). _arguments must also check for a "--" argument, and not do option completion (regardless of option style) if the cursor is after the "--". All of this then lets it decide whether to complete options or not; non-option arguments are always a possibility, though we might want to be clever about handling arguments that start with "-". -zefram