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

Re: Bug in _gnu_generic for "cp -a"?



On Fri, May 21, 2010 at 7:46 PM, Andy Spiegl <zsh.Andy@xxxxxxxxx> wrote:
> On 2010-05-20, 07:45, Bart Schaefer wrote:
>> On Wed, May 19, 2010 at 10:37 AM, Andy Spiegl <zsh.Andy@xxxxxxxxx> wrote:
>> > On 2010-05-19, 08:30, Bart Schaefer wrote:
>> >>
>> You said before that you have this completion problem only with the
>> -a option, but do you by chance also have it with the -d option,
>> which also has an "=" in the description?
>
> I tested and: YES
> Also with -p which also has an "=" in the help description.
> So I guess your assumption is very good!

OK, so the problem seems to be here:

      # Ignore :descriptions at the ends of lopts for matching this;
      # they aren't in the patterns.
      tmp=("${(@M)lopts:##$~pattern(|:*)}")
      lopts=("${(@)lopts:##$~pattern(|:*)}")

I'm still not quite following this, but I think that stuff is supposed
to distinguish descriptions of options from descriptions of the
arguments those options accept.  If that doesn't happen correctly, the
options having descriptions containing an "=" later reach this ...

      # Descriptions with `=': mandatory argument.
      # Basically the same as the foregoing.
      # TODO: could they be combined?

      tmpo=("${(@M)tmp:#*\=*}")
      if (( $#tmpo )); then
        tmp=("${(@)tmp:#*\=*}")

and in that block they get transformed from e.g -a:description: to
-a=[description] which is wrong.



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