From 0c82828e8679105adcb53765f8a65f666b08f7c4 Mon Sep 17 00:00:00 2001 From: Peter Stephenson Date: Wed, 24 Sep 2003 14:53:19 +0000 Subject: unposted: improve Perforce label completion --- Completion/Unix/Command/_perforce | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'Completion') 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 } -- cgit 1.4.1