Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: _perforce completer

Peter Stephenson wrote:

Michael Denio wrote:


I made a change to the _perforce completer to optionally restrict the list of changes to only those owned by the current user. To whom should I send the patch?


I've attached the patch

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.

Michael Denio (Michael.Denio@xxxxxxxxxxxxxxxxx)
Equity Trading Infrastructure
--- _perforce.orig	Fri Apr 23 11:53:07 2004
+++ _perforce	Fri Apr 23 11:23:14 2004
@@ -495,9 +495,13 @@
 (( $+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 auser
   zstyle -s ":completion:${curcontext}:changes" max max || max=20
+	if zstyle -t ":completion:${curcontext}:changes" current_user; then
+    auser=(-u $USER)
+  fi
   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 +552,7 @@
   # Limit to the 20 most recent changes by default to avoid huge
   # output.
-${${${${(f)"$(_perforce_call_p4 changes changes $amax $cstatus \$file)"}##Change\ }//\ on\ /:}/\ by\ /\ }
+${${${${(f)"$(_perforce_call_p4 changes changes $auser $amax $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

Messages sorted by: Reverse Date, Date, Thread, Author