3 # Helper function for _path_files to handle the file-list style.
6 # name of parameter containing file matches
8 # Sets array listfiles to the display strings and the array
9 # listopts appropriately to be added to the compadd command line.
11 local stat f elt what dir
18 zstyle -a ":completion:${curcontext}:" file-list stylevals || return 1
20 # TODO: more flexible way of handling the following? e.g. use $compstate?
31 for elt in $stylevals; do
33 (*($what|all|true|1|yes)*=<->)
34 # use long format if no more than the given number of matches
35 (( ${(P)#1} <= ${elt##*=} )) && (( ok = 1 ))
39 (*($what|all|true|1|yes)[^=]#)
40 # always use long format
49 zmodload -F zsh/stat b:zstat 2>/dev/null || return 1
55 if [[ ! -e "$dir$f" ]]; then
60 # Borrowed from Functions/Example/zls
61 zstat -s -H stat -F "%b %e %H:%M" - "$dir$f" >/dev/null 2>&1
63 listfiles+=("$stat[mode] ${(l:3:)stat[nlink]} ${(r:8:)stat[uid]} \
64 ${(r:8:)stat[gid]} ${(l:8:)stat[size]} $stat[mtime] $f")
67 (( ${#listfiles} )) && listopts=(-d listfiles -l -o)