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

Passsing descriptions down in completion functions



Either I do not understand something basic or it does not work (and probably
has never working really).

Simple example.

bor@itsrm2% functions _foo
_foo () {
        _arguments -s "-p[some option]:argument for this option:_hosts"
}
bor@itsrm2% compdef _foo foo
bor@itsrm2% foo -p TAB
bor@itsrm2% foo -p D248H032
Completing host
           ^^^^ should it not be "argument for that option"?
D248H032               GH4090Y0               anyhost
...

It is clear what happens:

+_arguments:340> _hosts -J option-p-1 -X '%BCompleting argument for this
option%b'

this sounds good, but later on ...

+_all_labels:37> compadd -J hosts -X '%BCompleting host%b' -M
'm:{a-zA-Z}={A-Za-z} r:|.=* r:|=*' -J option-p-1 -X '%BCompleting argument
for this option%b' -a hosts

Oops, description is now lost.

Quoting documentation:

                                              If the ACTION starts
     with a space, this list of words will be invoked unchanged,
     otherwise it will be invoked with some extra strings placed after
     the first word which can be given as arguments to the compadd
     builtin command and which make sure that the MESSAGE given in the
     description will be shown above the matches.

So, is it a bug or not?

-andrej



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