Diff
1diff --git a/plugins/fabric/_fab b/plugins/fabric/_fab
2index 4c2e61306929242af220383a019e5fec43882636..89e73e58bfa605d81662e6f2ba554a47d3dc00b7 100644
3--- a/plugins/fabric/_fab
4+++ b/plugins/fabric/_fab
5@@ -4,10 +4,19 @@
6 local curcontext=$curcontext state line
7 declare -A opt_args
8
9-declare target_list
10-target_list=(`fab --shortlist 2>/dev/null || fab --complete 2>/dev/null`)
11+declare -a target_list
12+target_list=("${(@f)$(fab -l 2>/dev/null | awk '{
13+ if (NF == 0 || NR == 1) return
14+ if (NF < 2) print $1
15+ else {
16+ docstring=substr($0, index($0,$2))
17+ gsub(":", "\\:", docstring)
18+ print $1":"docstring
19+ }
20+}')}")
21
22-_targets() {
23+_fab_targets() {
24+ [[ -n "$target_list" ]] || return
25 _describe -t commands "fabric targets" target_list
26 }
27
28@@ -28,7 +37,7 @@ _arguments -w -S -C \
29 '(-)--shortlist[print non-verbose list of possible commands and exit]: :->noargs' \
30 '(--reject-unknown-hosts)--reject-unknown-hosts[reject unknown hosts]' \
31 '(--no-pty)--no-pty[do not use pseudo-terminal in run/sudo]' \
32- "(-d+ --display=-)"{-d+,--display=-}"[print detailed info about a given command]: :_targets" \
33+ "(-d+ --display=-)"{-d+,--display=-}"[print detailed info about a given command]: :_fab_targets" \
34 '(-D --disable-known-hosts)'{-D,--disable-known-hosts}'[do not load user known_hosts file]' \
35 '(-r --reject-unknown-hosts)'{-r,--reject-unknown-hosts}'[reject unknown hosts]' \
36 '(-u+ --user=-)'{-u+,--user=-}'[username to use when connecting to remote hosts]: :' \
37@@ -53,7 +62,7 @@ if [[ CURRENT -ge 1 ]]; then
38 levels)
39 _describe -t commands "output levels" output_levels;;
40 *)
41- _targets;;
42+ _fab_targets;;
43 esac
44
45 return