aboutsummaryrefslogtreecommitdiff
path: root/Completion/Base/_brace_parameter
blob: 5993aecba93dd1b9ab0cb4f57f4a9ea6ecd49ba4 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#compdef -brace-parameter-

setopt localoptions extendedglob

local lp ls n q suf=''

if [[ "$SUFFIX" = *\}* ]]; then
  ISUFFIX="${SUFFIX#*\}}$ISUFFIX"
  SUFFIX="${SUFFIX%%\}*}"
else
  suf='} '
fi

lp="$LBUFFER[1,-${#PREFIX}-1]"
ls="$RBUFFER[${#SUFFIX}+1,-1]"
n=${(M)#ls##\"#}
q=${(M)lp%%\"#}

[[ n -gt 0 ]] && suf=''

_parameters -s "${q[1,-n-1]}" -S "$suf" -r '-:?#%+=[/'