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

how to revert tab completion order in _arguments or _describe


I wrote a small tab completion function
(https://github.com/pseyfert/lb-zsh/blob/master/_lb-run) to complete the
lb-run Bender <some_version_number> <some executable command>

I defined this with
_arguments '-l[list versions]' '1:project:($projects)' '2:version:->listversions' '3:command:->runnablestuff'
case $state in
    ### essentially _command_names -e
    local -a versionlist
    # lb-dev -l querries for existing version numbers
    versionlist=($(lb-dev -l $line[1] | sed "s/ .*//" ))
    # versionlist is now a list of existing version numbers
    _describe 'project versions' versionlist

It reasonably works:
pseyfert@computer ~ > lb-run Bender v2<tab>
project versions:
v25r5p1  v25r7p3  v26r0    v26r2p1  v26r3p1  v27r0p1
v25r7p2  v25r7p4  v26r1    v26r3    v27r0    v28r0

One drawback though is that I'm usually most interested in the latest
version number but the menu completion starts with the oldest version
number (i think it's alphabetically ordered). Is there a way to tell the
_describe in the (listversions) state to cycle through the options in a
specific order? (actually i'm not bound to stick to _describe there, any
other function would be fine, too)

Thanks in advance,


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