1#autoload
2
3local format raw gopt
4
5if [[ "$1" = -e ]]; then
6  local expl ret=1 tag
7
8  _comp_mesg=yes
9
10  if (( $# > 2 )); then
11    tag="$2"
12    shift
13  else
14    tag="$curtag"
15  fi
16  _tags "$tag" && while _next_label "$tag" expl "$2"; do
17    compadd ${expl:/-X/-x}
18    ret=0
19  done
20
21  (( $compstate[nmatches] )) || compstate[insert]=
22
23  return ret
24fi
25
26gopt=()
27zparseopts -D -a gopt 1 2 V J
28
29_tags messages || return 1
30
31if [[ "$1" = -r ]]; then
32  raw=yes
33  shift
34  format="$1"
35else
36  zstyle -s ":completion:${curcontext}:messages" format format ||
37      zstyle -s ":completion:${curcontext}:descriptions" format format
38fi
39
40if [[ -n "$format$raw" ]]; then
41  [[ -z "$raw" ]] && zformat -f format "$format" "d:$1" "${(@)argv[2,-1]}"
42  builtin compadd "$gopt[@]" -x "$format"
43  _comp_mesg=yes
44fi
45