summary refs log tree commit diff
path: root/Completion/Unix/Command
diff options
context:
space:
mode:
authorPeter Stephenson <pws@zsh.org>2013-05-14 14:25:14 +0100
committerPeter Stephenson <pws@zsh.org>2013-05-14 14:25:14 +0100
commitaa7467b0bfcf1e28fd2b2b91a88040946c680e59 (patch)
treef6e92b6886a17b20ceb8580ffb7ec8c24cfbfa34 /Completion/Unix/Command
parentbb6e894f2700bb92c44438dd62a7f921d106dca1 (diff)
downloadzsh-aa7467b0bfcf1e28fd2b2b91a88040946c680e59.tar.gz
zsh-aa7467b0bfcf1e28fd2b2b91a88040946c680e59.tar.xz
zsh-aa7467b0bfcf1e28fd2b2b91a88040946c680e59.zip
Improve Perforce jobs completion to limit
potentially huge output using jobview by default;
fix quoting of arguments passed on to eval within _call_program.
Diffstat (limited to 'Completion/Unix/Command')
-rw-r--r--Completion/Unix/Command/_perforce10
1 files changed, 6 insertions, 4 deletions
diff --git a/Completion/Unix/Command/_perforce b/Completion/Unix/Command/_perforce
index d2943472c..bcfe5229a 100644
--- a/Completion/Unix/Command/_perforce
+++ b/Completion/Unix/Command/_perforce
@@ -1401,16 +1401,18 @@ _perforce_jobs() {
   if [[ $argv[-2] = -e ]]; then
     ajobview=(-e "${(q)argv[-1]}")
     argv=("${(@)argv[1,-3]}")
-  else
-    zstyle -s ":completion:${curcontext}:jobs" jobview jobview &&
-    ajobview=(-e $jobview)
+  elif zstyle -s ":completion:${curcontext}:jobs" jobview jobview; then
+    ajobview=(-e "'$jobview'")
+  elif [[ -n $PREFIX ]]; then
+    # Extra quotes for the benefit of _call_program which does an "eval".
+    ajobview=(-e "'job=$PREFIX\\*$SUFFIX'")
   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,
   # show the full description for the job which is on the line at
   # the moment.
-    _message -r "$(_perforce_call_p4 jobs jobs -e \"Job=\$PREFIX\$SUFFIX\" -l 2>/dev/null)"
+    _message -r "$(_perforce_call_p4 jobs jobs -e \"'Job=\$PREFIX\$SUFFIX'\" -l 2>/dev/null)"
     return 0
   elif [[ ${NUMERIC:-0} -gt 0 ]]; then
     max=$NUMERIC