From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 22178 invoked from network); 3 Jul 2005 01:36:46 -0000 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by ns1.primenet.com.au with SMTP; 3 Jul 2005 01:36:46 -0000 Received: (qmail 76183 invoked from network); 3 Jul 2005 01:36:39 -0000 Received: from sunsite.dk (130.225.247.90) by a.mx.sunsite.dk with SMTP; 3 Jul 2005 01:36:39 -0000 Received: (qmail 25628 invoked by alias); 3 Jul 2005 01:36:27 -0000 Mailing-List: contact zsh-users-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 9011 Received: (qmail 25618 invoked from network); 3 Jul 2005 01:36:26 -0000 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by sunsite.dk with SMTP; 3 Jul 2005 01:36:26 -0000 Received: (qmail 75019 invoked from network); 3 Jul 2005 01:36:26 -0000 Received: from vanunu.ucsc.edu (128.114.141.22) by a.mx.sunsite.dk with SMTP; 3 Jul 2005 01:36:20 -0000 Received: from localhost (localhost [127.0.0.1]) by vanunu.ucsc.edu (Postfix) with ESMTP id 5518A613687; Sat, 2 Jul 2005 18:36:24 -0700 (PDT) Date: Sat, 2 Jul 2005 18:36:24 -0700 (PDT) From: William Scott X-X-Sender: wgscott@vanunu.ucsc.edu To: zsh-users@sunsite.dk Cc: William Scott Subject: Re: metadata completion functions for OS X 10.4 In-Reply-To: <20050612025130.52740.qmail@web52809.mail.yahoo.com> Message-ID: References: <20050612025130.52740.qmail@web52809.mail.yahoo.com> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Spam-Checker-Version: SpamAssassin 3.0.2 on a.mx.sunsite.dk X-Spam-Level: X-Spam-Status: No, score=-2.6 required=6.0 tests=AWL,BAYES_00 autolearn=ham version=3.0.2 X-Spam-Hits: -2.6 Hi folks: I am trying to write some completion functions for the new metadata utilities distributed with Mac OS X v. 10.4.x. that make fast searches possible. Currently I have a simple one for the mdls command that seems to behave: http://xanana.ucsc.edu/Library/init/zsh/local-functions/darwin/_mdls The one I am trying to write for _mdfind isn't very good currently, and could benefit from someone who really knows what they are doing having a look at it: http://xanana.ucsc.edu/Library/init/zsh/local-functions/darwin/_mdfind Hopefully the comments at the top give the basic idea. It suffers from several problems that I am sure are straightforward for people who understand this stuff better than I do. 1. In my _mdls function, I have some zstyles at the top that work straight away. But in the _mdfind function, they don't kick in until the second time it is invoked. 2. There are two types of commands one can issue with mdfind that don't have -x type arguments, eg: mdfind "kMDItemContentType == ''" mdfind I'm not sure how to differentiate between the two types of commands. What I have sort of works, but it seems quite clunky and amaturish. 3. For completions of the command of the form mdfind "kMDItemContentType == ''" I am using compadd -P \" -p kMDItem -S " == '" to add in the first set of double-quotes, then the constant prefix kMDItem and then a suffix == ' but I am not sure how to prompt for the string and then automatically close first the single quote and then the double quote. Also occasionally I seem to wind up with mdfind """kMDItemContentType == '" If anyone has suggestions or could point me toward relevant examples I would be grateful. Thanks in advance. Bill Scott