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

Re: completion issue



On Jun 11,  4:06pm, Vadim A. Misbakh-Soloviov wrote:
}
} Little update:
} I just fuound, that problem is in my
} > zstyle ':completion:::::' completer _expand _force_rehash _complete _ignored _gnu_generic _approximate
} > zstyle ':completion:*' completer _complete _ignored _gnu_generic _approximate _oldlist _force_rehash

Ah ... _gnu_generic is not intended to be placed in the "completer" style.
It's designed to be called from (or in place of) a completion function
for a specific command.  There are some special requirements needed for
functions in the "completer" style that most of the other functions do
not meet; a few work anyway by accident, but _gnu_generic is not one.

Hence the _gnu_generic documentation note that says:

     The completion system as supplied is conservative in its use of
     this function, since it is important to be sure the command
     understands the option `--help'.

This could probably go on to say that the command must not merely
understand --help, it must produce the help output in the specific
formatting that FSF software normally employs.

The actual --help parser is in the _arguments function itself.  Look for
this comment:

    # Now get the long option names by calling the command with `--help'.
    # The parameter expansion trickery first gets the lines as separate
    # array elements. Then we select all lines whose first non-blank
    # character is a hyphen. Since some commands document more than one
    # option per line, separated by commas, we convert commas into
    # newlines and then split the result again at newlines after joining 
    # the old array elements with newlines between them. Then we select
    # those elements that start with two hyphens, remove anything up to
    # those hyphens and anything from the space or tab after the
    # option up to the end.



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