1
0
Fork 0
mirror of git://git.code.sf.net/p/zsh/code synced 2025-11-01 06:20:55 +01:00

Improve Perforce jobs completion to limit

potentially huge output using jobview by default;
fix quoting of arguments passed on to eval within _call_program.
This commit is contained in:
Peter Stephenson 2013-05-14 14:25:14 +01:00
parent bb6e894f27
commit aa7467b0bf
2 changed files with 13 additions and 4 deletions

View file

@ -1,3 +1,10 @@
2013-05-14 Peter Stephenson <p.stephenson@samsung.com>
* unposted: Completion/Unix/Command/_perforce: Improve
Perforce jobs completion to limit potentially huge output
using jobview by default; fix quoting of arguments passed on
to eval within _call_program.
2013-05-10 Peter Stephenson <p.stephenson@samsung.com>
* Richard Hartmann <richih.mailinglist@gmail.com>: 31389:

View file

@ -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