From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 18708 invoked by alias); 28 Jun 2018 19:57:35 -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: List-Unsubscribe: X-Seq: 23511 Received: (qmail 28834 invoked by uid 1010); 28 Jun 2018 19:57:35 -0000 X-Qmail-Scanner-Diagnostics: from 195.159.176.226 by f.primenet.com.au (envelope-from , uid 7791) with qmail-scanner-2.11 (clamdscan: 0.99.2/21882. spamassassin: 3.4.1. Clear:RC:0(195.159.176.226):SA:0(2.6/5.0):. Processed in 0.441277 secs); 28 Jun 2018 19:57:35 -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=2.6 required=5.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, FORGED_MUA_MOZILLA,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,NML_ADSP_CUSTOM_MED,RDNS_NONE autolearn=no autolearn_force=no version=3.4.1 X-Envelope-From: gcszu-zsh-users@m.gmane.org X-Qmail-Scanner-Mime-Attachments: | X-Qmail-Scanner-Zip-Files: | X-Injected-Via-Gmane: http://gmane.org/ To: zsh-users@zsh.org From: "Scott Frazer (scfrazer)" Subject: Completion of two items separated by a dash Date: Thu, 28 Jun 2018 15:40:09 -0400 Message-ID: Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-Complaints-To: usenet@blaine.gmane.org User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.8.0 X-Mozilla-News-Host: news://news.gmane.org:119 Content-Language: en-US I am trying to write a completion function for a command that takes two items separated by a dash, and the second item depends on the first. For example, suppose possible full completions were: foo-bar foo-baz abc-def abc-xyz Ideally, the completion function would first present options "foo" and "abc", then after the user chooses one it inserts the "-', and when you hit tab again it presents either "bar" and "baz" or "def" and "xyz". For this simple example I could just show all four, but in real life there are many first items and many second items and the list would be huge. I have written some simple completions before, but this has me stumped. Is there a way to do this? Thanks, Scott