Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: metadata completion functions for OS X 10.4
- X-seq: zsh-users 9011
- From: William Scott <wgscott@xxxxxxxxxxxxxxxxxx>
- To: zsh-users@xxxxxxxxxx
- Subject: Re: metadata completion functions for OS X 10.4
- Date: Sat, 2 Jul 2005 18:36:24 -0700 (PDT)
- Cc: William Scott <wgscott@xxxxxxxxxxxxxxxxxx>
- In-reply-to: <20050612025130.52740.qmail@xxxxxxxxxxxxxxxxxxxxxxx>
- Mailing-list: contact zsh-users-help@xxxxxxxxxx; run by ezmlm
- References: <20050612025130.52740.qmail@xxxxxxxxxxxxxxxxxxxxxxx>
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 == '<any string>'"
mdfind <any string>
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 == '<any string>'"
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
Messages sorted by:
Reverse Date,
Date,
Thread,
Author