Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

PATCH: Re: _rsync duplicated options in completion



Wayne Davison wrote:

> On Thu, 16 May 2002, Bart Schaefer wrote:
> > The problem is that the `--' argument to _arguments is causing the
> > output from `rsync --help' to be merged with the long list of options
> > provided in the completion function itself.  Instead of recognizing
> > that there are overlaps, every option is being presented twice.
> 
> I've discovered that the problem stems from the rsync options containing
> "--foo=BAR" items (such as --ignore=FILE and --include=PATTERN) while
> the options in the _rsync file only say "--foo=".  [...]

Yep.

> This makes the duplicated-option bug goes away.  Someone may want to
> translate that into a zsh expansion pattern to avoid the call to sed.
> OR, we may want to add the ability to specify an option like
> "--include=PATTERN" in the _rsync file and have the PATTERN part only
> show up as part of the help text, but not be included when completing
> the option name.

Strange, when I found the bug, I thought about automatically including
it in the description, too. No patch for that yet, though (and even
then user-defined specs should take preference).


Plus a fix for a typo in _rsync.


Bye
  Sven

Index: Completion/Base/Utility/_arguments
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Base/Utility/_arguments,v
retrieving revision 1.12
diff -u -r1.12 _arguments
--- Completion/Base/Utility/_arguments	14 May 2002 08:08:45 -0000	1.12
+++ Completion/Base/Utility/_arguments	21 May 2002 07:41:42 -0000
@@ -74,11 +74,11 @@
     # Remove options also described by user-defined specs.
 
     tmp=()
-    for opt in "${(@)lopts:#--}"; do
+    for opt in "${(@)${(@)lopts:#--}%%\=*}"; do
 
       # Using (( ... )) gives a parse error.
 
-      let "$tmpargv[(I)(|\([^\)]#\))(|\*)${opt}(|[-+=])(|\[*\])(|:*)]" ||
+      let "$tmpargv[(I)(|\([^\)]#\))(|\*)${opt}(|[-+]|=(|-))(|\[*\])(|:*)]" ||
           tmp=( "$tmp[@]" "$opt" )
     done
     lopts=( "$tmp[@]" )
Index: Completion/Unix/Command/_rsync
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Unix/Command/_rsync,v
retrieving revision 1.4
diff -u -r1.4 _rsync
--- Completion/Unix/Command/_rsync	16 Apr 2002 07:48:46 -0000	1.4
+++ Completion/Unix/Command/_rsync	21 May 2002 07:41:43 -0000
@@ -121,7 +121,7 @@
  	'(--whole-file)-W[copy whole files]' \
  	'(-W)--whole-file[copy whole files]' \
  	'(--one-file-system)-x[do not cross filesystem boundaries]' \
- 	'(-x)-one-file-system[do not cross filesystem boundaries]' \
+ 	'(-x)--one-file-system[do not cross filesystem boundaries]' \
  	'(--block-size)-B[checksum blocking size]:block size:' \
  	'(-B)--block-size=[checksum blocking size]:block size:' \
  	'(--rsh)-e[rsh command]:remote command:(rsh ssh)' \

-- 
Sven Wischnowsky                          wischnow@xxxxxxxxx



Messages sorted by: Reverse Date, Date, Thread, Author