From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 929 invoked by alias); 29 Apr 2016 15:35:12 -0000 Mailing-List: contact zsh-users-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Users List List-Post: List-Help: X-Seq: 21505 Received: (qmail 27664 invoked from network); 29 Apr 2016 15:35:09 -0000 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.1 To: Zsh Users From: Paul Seyfert Subject: how to revert tab completion order in _arguments or _describe X-Enigmail-Draft-Status: N1110 Message-ID: <572375FD.80200@mathphys.fsk.uni-heidelberg.de> Date: Fri, 29 Apr 2016 16:55:57 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Icedove/38.7.0 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Hi, I wrote a small tab completion function (https://github.com/pseyfert/lb-zsh/blob/master/_lb-run) to complete the command ``` lb-run Bender ``` I defined this with ``` _arguments '-l[list versions]' '1:project:($projects)' '2:version:->listversions' '3:command:->runnablestuff' case $state in (runnablestuff) ### essentially _command_names -e (listversions) 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 ;; esac ``` It reasonably works: ``` pseyfert@computer ~ > lb-run Bender v2 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, Paul