From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 29090 invoked by alias); 7 Dec 2010 11:53:52 -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: 15632 Received: (qmail 16429 invoked from network); 7 Dec 2010 11:53:50 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_LOW, SPF_HELO_PASS autolearn=ham version=3.3.1 Received-SPF: none (ns1.primenet.com.au: domain at csr.com does not designate permitted sender hosts) Date: Tue, 7 Dec 2010 11:52:22 +0000 From: Peter Stephenson To: Zsh Users Subject: Re: Using the same completion function for various commands Message-ID: <20101207115222.34859d66@pwslap01u.europe.root.pri> In-Reply-To: <15197.1291664361@thecus> References: <201012061512.21791.mrichter@theory.phy.tu-dresden.de> <20101206151124.389fd287@pwslap01u.europe.root.pri> <15197.1291664361@thecus> Organization: Cambridge Silicon Radio X-Mailer: Claws Mail 3.7.6 (GTK+ 2.20.1; i386-redhat-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-OriginalArrivalTime: 07 Dec 2010 11:52:22.0870 (UTC) FILETIME=[359D5F60:01CB9605] X-Scanned-By: MailControl A_10_80_00 (www.mailcontrol.com) on 10.71.0.121 On Mon, 06 Dec 2010 20:39:21 +0100 Oliver Kiddle wrote: > Peter wrote: > > Why we would ever prefer $words[1] to $service, when this seems > > to be what $service is for? > > Aside from the case Bart mentioned, there's also cases like: > compdef gdu=du It looks like you can't in general distinguish between two ways of using the service: - A command (gdu) is an instance of a basic command (du) for which completion exists, but under a different name (as above). The basic command might exist but your best bet for picking the right version is to run the new instance. - A command has some behaviour related to, or acts as a front end for, a basic command but possibly doesn't fully implement it and might not be useful for finding out the version of the interface. Then you'd need to run the basic command. In the first case you have the simple alternative of defining #compdef gdu _du "$@" which fixes the service for you. -- Peter Stephenson Software Engineer Tel: +44 (0)1223 692070 Cambridge Silicon Radio Limited Churchill House, Cambridge Business Park, Cowley Road, Cambridge, CB4 0WZ, UK Member of the CSR plc group of companies. CSR plc registered in England and Wales, registered number 4187346, registered office Churchill House, Cambridge Business Park, Cowley Road, Cambridge, CB4 0WZ, United Kingdom