zsh-users
 help / color / mirror / code / Atom feed
From: Motoi Washida <a66@h8.dion.ne.jp>
To: zsh-users@sunsite.dk
Cc: lists <lists@kalama.no-ip.org>
Subject: Re: Completion functions for Mac OS X
Date: Mon, 17 Jan 2005 01:08:20 +0900	[thread overview]
Message-ID: <D72A535D-67D8-11D9-AF71-000D93502E64@h8.dion.ne.jp> (raw)
In-Reply-To: <D010BCC1-6716-11D9-9019-000A95D2C79E@kalama.no-ip.org>

Hi Ryan,

On 2005/01/16, at 1:59, lists wrote:

> defaults read /Applications/TextEdit.app/Contents/Info
>
> will normally display the contents of 
> /Applications/TextEdit.app/Contents/Info.plist
Heh. I didn't know that. Is this a hidden feature? I can't find any 
documents about that.

> If I use the _defaults completion, this doesn't work (and neither does 
> TAB completion: 'defaults read /App<TAB>').  Could _defaults be 
> modified to allow for viewing of xml files which aren't registered as 
> a defaults domain?  I'd love to help but haven't been able to get the 
> hang of writing completions yet.
Here is a patch to complete plist files.

--
Motoi Washida

Index: Completion/Darwin/Command/_defaults
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Darwin/Command/_defaults,v
retrieving revision 1.1
diff -d -u -r1.1 _defaults
--- Completion/Darwin/Command/_defaults	23 Jul 2004 13:38:12 -0000	1.1
+++ Completion/Darwin/Command/_defaults	16 Jan 2005 15:43:35 -0000
@@ -1,12 +1,16 @@
  #compdef defaults

  _defaults_domains(){
-  local str="$(_call_program domains defaults domains 2>/dev/null)"
-  local expl
-  local -a list
-  list=( ${(s/, /)str} -g -globalDomain )
-  _wanted domains expl 'defaults database domain' \
-      compadd -M 'r:|.=* r:|=*' -a list
+  if [[ "`eval echo $PREFIX`" != [/~]* ]]; then
+    local str="$(_call_program domains defaults domains 2>/dev/null)"
+    local expl
+    local -a list
+    list=( ${(s/, /)str} -g -globalDomain )
+    _wanted domains expl 'defaults database domain' \
+        compadd -M 'r:|.=* r:|=*' -a list
+  else
+    _files -g '*.plist(e:"reply=\${REPLY%.plist}":)'
+  fi
  }

  _defaults_keys(){


  reply	other threads:[~2005-01-16 16:08 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <ED23CF10-DBCD-11D8-BFB6-000D93502E64@h8.dion.ne.jp>
     [not found] ` <5F375244-DBDD-11D8-8A54-000D93502E64@h8.dion.ne.jp>
2005-01-15 16:59   ` lists
2005-01-16 16:08     ` Motoi Washida [this message]
2005-01-18  2:10       ` lists

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=D72A535D-67D8-11D9-AF71-000D93502E64@h8.dion.ne.jp \
    --to=a66@h8.dion.ne.jp \
    --cc=lists@kalama.no-ip.org \
    --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).