From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 28059 invoked by alias); 28 Jun 2018 20:03:58 -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: 23512 Received: (qmail 16295 invoked by uid 1010); 28 Jun 2018 20:03:58 -0000 X-Qmail-Scanner-Diagnostics: from mout.gmx.net 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(212.227.15.19):SA:0(-2.6/5.0):. Processed in 1.174108 secs); 28 Jun 2018 20:03:58 -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,FREEMAIL_FROM, RCVD_IN_DNSWL_LOW,SPF_PASS autolearn=ham autolearn_force=no version=3.4.1 X-Envelope-From: llua@gmx.com X-Qmail-Scanner-Mime-Attachments: | X-Qmail-Scanner-Zip-Files: | Subject: Re: Completion of two items separated by a dash To: zsh-users@zsh.org References: From: Eric Cook Message-ID: Date: Thu, 28 Jun 2018 16:03:47 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.8.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-Provags-ID: V03:K1:ASloyuv2Y6q/6iYllpF3k9OL1lURNkzP5q9mV5SaVWbSowAzxRT xneUIarBkdKWnPVnKgi8UlZvdEBcQY/+WppqZeHYfZUoSjkXZZNwb2jlwOoEqslHS3HWAqp r8akjVkjGrfMM40ahZAm1EiNI2AcVBNYr7gchrChTtNF6rQwzPqZ2WwCt1fm5JF+SZnDA46 HyUDK+fsCjEUVu8WUe9lQ== X-UI-Out-Filterresults: notjunk:1;V01:K0:ghylbmeZeYA=:gBWN1ofHsYJWcjMPsoRhoH c4naPhkY/Fa8/HYS4lJxSzTLmlx5PTXmM6A1tDzrScUregKwUjiE/3+ZH7spQ6b4V7FglC31j My0poYhCcGNIrhXYYxhJi4si1oE07FbsEJFSabnbEaW1ZGifb9bv5dIxEKl3NNG1Ws+fNiJ8u cqjZ6Y/pgMjCQbTlo/Ugg+iuz1O24g+yph+nVFmDsxOYGJtSn5jCYbee/qV9o/xpDnjYFVgli LLjCyZKdw21E0zP307Zj4JhaITlVxNM1e7tCAVZap999CodghQ3NtupwOXvmEQN4mrhX49gcY 3qPqO/XzdiiN8VCOmNZwQHSrkOfZmjTkoNeE5zuWFWDZfkIkK/k2mbHpbTEerFCo4nlpfZwrd LgAnWOzEv1vBHTaCuzXy5Wtu7H0aiMtFRw599+WMVcgUXeSwJFoXkq2MM0YF9eniPvMwVuMnD KuFFmgkP7UkKeOHFl1V5aFktC4edMtQV0lMny+F1dPaNUJ1r2J4xpkD/3LEsuNqZkO3mx70H9 2FRF0655RCMnjxgg2VpmDuunXrmnZY7FzyF3ITVexYWNlqOJGR99Rtmykj8qLIlQKAZQG/lRN 5YTPChdpg5sn8dYqAK2gk5M+Of/UhCAdPAz/kVeoI20n9CbR+BLkSvk8f8TaZNy7rDD6omA+/ jxCQFkuAw2316zeQ8UYV3b9h3JqH+/1jh5ZuNk9D/gvLCHVx9Pif1cfZVCa6goi0Jv9s/VVbR Tw11fC1xjXudA8pwOuunM1s3GwONdpmPn5qmMg2Yd6mprZ3HF9s3C/1ALefl+zYNhUgIKK1LZ 46SoJha On 06/28/2018 03:40 PM, Scott Frazer (scfrazer) wrote: > 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 > _foo() { local -a ary ary=( foo-bar foo-baz abc-def abc-xyz ) _arguments '1:description:_multi_parts -- - ary' } compdef _foo foo