zsh-users
 help / color / mirror / code / Atom feed
From: William Scott <wgscott@chemistry.ucsc.edu>
To: zsh-users@sunsite.dk
Cc: William Scott <wgscott@chemistry.ucsc.edu>
Subject: Re: metadata completion functions for OS X 10.4
Date: Sat, 2 Jul 2005 18:36:24 -0700 (PDT)	[thread overview]
Message-ID: <Pine.OSX.4.58.0507021815330.28684@vanunu.ucsc.edu> (raw)
In-Reply-To: <20050612025130.52740.qmail@web52809.mail.yahoo.com>


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



      parent reply	other threads:[~2005-07-03  1:36 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-06-12  2:51 _retrieve_mac_apps bad chache problem Marco Zunino
2005-06-12  4:38 ` William Scott
2005-07-03  1:36 ` William Scott [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Pine.OSX.4.58.0507021815330.28684@vanunu.ucsc.edu \
    --to=wgscott@chemistry.ucsc.edu \
    --cc=zsh-users@sunsite.dk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).