about summary refs log tree commit diff
path: root/Completion/Unix/Command
diff options
context:
space:
mode:
authorPeter Stephenson <pws@users.sourceforge.net>2003-09-24 14:53:19 +0000
committerPeter Stephenson <pws@users.sourceforge.net>2003-09-24 14:53:19 +0000
commit0c82828e8679105adcb53765f8a65f666b08f7c4 (patch)
tree5e80beec173c7985095a28d9e8f1ead1846e3409 /Completion/Unix/Command
parent58bad19411cce9ee0a0edf3ef93acb475b7e7a79 (diff)
downloadzsh-0c82828e8679105adcb53765f8a65f666b08f7c4.tar.gz
zsh-0c82828e8679105adcb53765f8a65f666b08f7c4.tar.xz
zsh-0c82828e8679105adcb53765f8a65f666b08f7c4.zip
unposted: improve Perforce label completion
Diffstat (limited to 'Completion/Unix/Command')
-rw-r--r--Completion/Unix/Command/_perforce20
1 files changed, 10 insertions, 10 deletions
diff --git a/Completion/Unix/Command/_perforce b/Completion/Unix/Command/_perforce
index a76b64f52..8147244ba 100644
--- a/Completion/Unix/Command/_perforce
+++ b/Completion/Unix/Command/_perforce
@@ -875,7 +875,7 @@ _perforce_files() {
     _alternative \
       "changes:change:_perforce_changes $range -tf" \
       clients:client:_perforce_clients \
-      labels:label:_perforce_labels \
+      "labels:label:_perforce_labels -tf" \
       'dates:date (+ time):_perforce_dates'
   elif [[ -prefix *\# ]]; then
     # Modify context to indicate we are in a suffix.
@@ -1138,17 +1138,17 @@ _perforce_jobviews() {
 
 (( $+functions[_perforce_labels] )) ||
 _perforce_labels() {
-    local lline match mbegin mend
-    local -a ll
+    local lline file
+    local -a ll match mbegin mend
 
-    # May be completing after `@'.
-    compset -P '*@'
+    if [[ $argv[-1] = -tf ]]; then
+      argv=($argv[1,-2])
+      # Completing after `@'.
+      file=${${(Q)PREFIX}%%@*}
+      compset -P '*@'
+    fi
 
-    _perforce_call_p4 labels labels | while read lline; do
-	if [[ $lline = (#b)'Label '([^[:blank:]]##)' '(*) ]]; then
-	    ll+=("${match[1]}:${match[2]}")
-	fi
-    done
+    ll=(${${(f)"$(_perforce_call_p4 labels labels ${file:+\$file})"}//(#b)Label\ ([^[:blank:]]##)\ (*)/$match[1]:$match[2]})
     _describe -t labels 'Perforce label' ll
 }