zsh-workers
 help / color / mirror / code / Atom feed
From: Peter Stephenson <pws@csr.com>
To: Michael Denio <Michael.Denio@morganstanley.com>
Cc: zsh-workers@sunsite.dk
Subject: Re: _perforce completer
Date: Fri, 23 Apr 2004 17:22:40 +0100	[thread overview]
Message-ID: <5596.1082737360@csr.com> (raw)
In-Reply-To: "Michael Denio"'s message of "Fri, 23 Apr 2004 12:03:20 EDT." <40893E48.1010609@morganstanley.com>

Michael Denio wrote:
> > Note that it should use styles to be sufficiently general.  Something
> > similar to the jobview style would be appropriate:
> 
> It does.  Here is my zstyle line from .zshrc
> 
> zstyle ':completion:*:changes' current_user true
> 
> I user the value of $USER thinking it was more appropriate.  If you like 
> I could change it so the user name has to be specified.

This is perfectly workable, but on the whole I'm inclined to prefer my
proposal to avoid accumulating ever new arguments.

Now you need to do:

zstyle ':completion:*:changes' changes -u $USER

Is this OK?

Index: Completion/Unix/Command/_perforce
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Unix/Command/_perforce,v
retrieving revision 1.18
diff -u -r1.18 _perforce
--- Completion/Unix/Command/_perforce	11 Nov 2003 10:35:55 -0000	1.18
+++ Completion/Unix/Command/_perforce	23 Apr 2004 16:21:09 -0000
@@ -47,6 +47,12 @@
 #   p4 jobs -e 'user=pws'
 # i.e. those assigned to Perforce user `pws'.
 #
+# Completion of changes can be controlled by the `changes' style.
+# This takes additional arguments to be passed to `p4 changes'.
+# An obvious example is:
+#   zstyle ':completion:*:p4-*:changes' changes -u $USER
+# to limit changes to the present user.
+#
 # The style `all-files' is used to tell the completion system to
 # complete any file in a given context.  This is for use in places
 # where it would, for example, only complete files opened for editing.
@@ -495,9 +501,10 @@
 (( $+functions[_perforce_changes] )) ||
 _perforce_changes() {
   local cline match mbegin mend max ctype num comma file
-  local -a cl cstatus amax
+  local -a cl cstatus amax xargs
 
   zstyle -s ":completion:${curcontext}:changes" max max || max=20
+  zstyle -a ":completion:${curcontext}:changes" changes xargs
   if [[ ${NUMERIC:-0} -lt 0 && -z $compstate[insert] ]]; then
     # Not inserting (i.e. just listing) and given a negative
     # prefix argument.  Instead of listing possible completions,
@@ -548,7 +555,7 @@
   # Limit to the 20 most recent changes by default to avoid huge
   # output.
   cl=(
-${${${${(f)"$(_perforce_call_p4 changes changes $amax $cstatus \$file)"}##Change\ }//\ on\ /:}/\ by\ /\ }
+${${${${(f)"$(_perforce_call_p4 changes changes $amax $xargs $cstatus \$file)"}##Change\ }//\ on\ /:}/\ by\ /\ }
 "default:change not yet numbered")
   [[ $#cl -eq 1 && $cl[1] = '' ]] && cl=()
   _describe -t changes "${ctype}change" cl -V changes-unsorted $comma

-- 
Peter Stephenson <pws@csr.com>                  Software Engineer
CSR Ltd., Science Park, Milton Road,
Cambridge, CB4 0WH, UK                          Tel: +44 (0)1223 692070


**********************************************************************
This email and any files transmitted with it are confidential and
intended solely for the use of the individual or entity to whom they
are addressed. If you have received this email in error please notify
the system manager.

This footnote also confirms that this email message has been swept by
MIMEsweeper for the presence of computer viruses.

www.mimesweeper.com
**********************************************************************


  reply	other threads:[~2004-04-23 16:23 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-04-23 15:41 Michael Denio
2004-04-23 15:48 ` Clint Adams
2004-04-23 15:58 ` Peter Stephenson
2004-04-23 16:03   ` Michael Denio
2004-04-23 16:22     ` Peter Stephenson [this message]
2004-04-23 17:01       ` Michael Denio

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=5596.1082737360@csr.com \
    --to=pws@csr.com \
    --cc=Michael.Denio@morganstanley.com \
    --cc=zsh-workers@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).