about summary refs log tree commit diff
path: root/Completion/Core/_description
blob: 54518e49fc73ac645725544f1036e08d77afc3d4 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#autoload

local gropt format gname

gropt=(-J)

if [[ "$1" = -[VJ] ]]; then
  gropt=("$1")
  shift
elif [[ "$1" = -[VJ] ]]; then
  gropt=("-${1[3,-1]}" "${1[1,2]}")
  shift
fi

_lastdescr=( "$_lastdescr[@]" "$3" )

_style -s descriptions format format
_style -s "$1" group-name gname && [[ -z "$gname" ]] && gname="$1"

if [[ -n "$gname" ]]; then
  if [[ -n "$format" ]]; then
    eval "$2=($gropt ${(q)gname} -X ${(q)format//\\%d/$3})"
  else
    eval "$2=($gropt ${(q)gname})"
  fi
else
  if [[ -n "$format" ]]; then
    eval "$2=(-J -default- -X ${(q)format//\\%d/$3})"
  else
    eval "$2=(-J -default-)"
  fi
fi

return 0