From b0c5f09169ac31855ebf0e93772bb57b9635b380 Mon Sep 17 00:00:00 2001 From: Peter Stephenson Date: Mon, 28 May 2007 22:57:39 +0000 Subject: see 23479: add initial features support for modules --- Completion/Unix/Command/_chmod | 10 +++------- Completion/Unix/Command/_chown | 12 ++++-------- Completion/Unix/Command/_cvs | 9 ++++----- Completion/Unix/Type/_list_files | 15 ++------------- Completion/Zsh/Command/_stat | 2 +- Completion/Zsh/Command/_zstyle | 1 - Completion/Zsh/Type/_file_descriptors | 4 ++-- 7 files changed, 16 insertions(+), 37 deletions(-) (limited to 'Completion') diff --git a/Completion/Unix/Command/_chmod b/Completion/Unix/Command/_chmod index 3df93fd64..84013d591 100644 --- a/Completion/Unix/Command/_chmod +++ b/Completion/Unix/Command/_chmod @@ -54,13 +54,9 @@ case "$state" in ;; files) if [[ -n $opt_args[--reference] ]]; then - if zstyle -t ":completion:${curcontext}:" disable-stat; then - _files && ret=0 - else - zmodload -i zsh/stat 2>/dev/null - typeset -i8 ref=$(stat +mode $opt_args[--reference]) - _wanted files expl file _files -g "*(-.^f${ref#??})" && ret=0 - fi + zmodload -F zsh/stat zstat 2>/dev/null + typeset -i8 ref=$(zstat +mode $opt_args[--reference]) + _wanted files expl file _files -g "*(-.^f${ref#??})" && ret=0 elif [[ $words[2] = [0-7]## ]]; then _wanted files expl file _files -g "*(-.^f$words[2])" && ret=0 else diff --git a/Completion/Unix/Command/_chown b/Completion/Unix/Command/_chown index 3371e8ea4..9246db42c 100644 --- a/Completion/Unix/Command/_chown +++ b/Completion/Unix/Command/_chown @@ -50,14 +50,10 @@ case $state in files) (( $+opt_args[-h] || $+opt_args[--no-dereference] )) || deref="-" if (( $+opt_args[--reference] )); then - if zstyle -t ":completion:${curcontext}:" disable-stat; then - _files && ret=0 - else - zmodload -i zsh/stat 2>/dev/null - usr=$(stat +uid $opt_args[--reference]) - grp=$(stat +gid $opt_args[--reference]) - _wanted files expl file _files -g "*($deref^u$usr,$deref^g$grp)" && ret=0 - fi + zmodload -F zsh/stat zstat 2>/dev/null + usr=$(zstat +uid $opt_args[--reference]) + grp=$(zstat +gid $opt_args[--reference]) + _wanted files expl file _files -g "*($deref^u$usr,$deref^g$grp)" && ret=0 return ret fi if [[ $service = chgrp ]]; then diff --git a/Completion/Unix/Command/_cvs b/Completion/Unix/Command/_cvs index 839075f64..c5fd75050 100644 --- a/Completion/Unix/Command/_cvs +++ b/Completion/Unix/Command/_cvs @@ -550,11 +550,10 @@ _cvs_watchers() { (( $+functions[_cvs_loadstat] )) || _cvs_loadstat() { - zstyle -t ":completion:${curcontext}:" disable-stat && return 1 (( $+_cvs_loadstat_status )) && return $_cvs_loadstat_status - zmodload -i zsh/stat 2>/dev/null - (( _cvs_loadstat_status = ! $+builtins[stat] )) + zmodload -F zsh/stat zstat 2>/dev/null + (( _cvs_loadstat_status = ! $+builtins[zstat] )) return $_cvs_loadstat_status } @@ -566,7 +565,7 @@ _cvs_root() { if [[ -f "${cvspassfile::=${CVS_PASSFILE:-$HOME/.cvspass}}" ]]; then if _cvs_loadstat; then - id="$(LC_ALL=C builtin stat -g +mtime -F '%Y/%m/%d-%T' "$cvspassfile")" + id="$(LC_ALL=C builtin zstat -g +mtime -F '%Y/%m/%d-%T' "$cvspassfile")" else id="$(LC_ALL=C ls -l "$cvspassfile")" fi @@ -865,7 +864,7 @@ _cvs_modified_entries() { realdir=${(e)~linedir} [[ -f "$realdir"CVS/Entries ]] && { local -a mtime - LC_ALL=C builtin stat -A mtime -gn +mtime -F $'%a %b %e %T %Y\n' ${realdir}*(D) 2>/dev/null + LC_ALL=C builtin zstat -A mtime -gn +mtime -F $'%a %b %e %T %Y\n' ${realdir}*(D) 2>/dev/null [[ -n ${pat::="${(@j:|:)${(@)${(@)${(@)${(@)${(@)${(@M)${(@f)"$(<"$realdir"CVS/Entries)"}:#/*}#/}/${slash}[^${slash}]#${slash}//}%/[^/]#/[^/]#}:#${(j:|:)~${(f)${(j:/:)${mtime##*/}}//(#m)[][*?()<|^~#\\]/\\$MATCH}#/}}%%/*}//(#m)[][*?()<|^~#\\]/\\$MATCH}"} ]] } && _wanted files expl 'modified file' _path_files -g "$pat" diff --git a/Completion/Unix/Type/_list_files b/Completion/Unix/Type/_list_files index 8475d2056..bcb42907d 100644 --- a/Completion/Unix/Type/_list_files +++ b/Completion/Unix/Type/_list_files @@ -46,15 +46,7 @@ done (( ok )) || return 1 -zmodload -i zsh/stat 2>/dev/null || return 1 - -{ -# Enable stat temporarily if disabled to avoid clashes. -integer disable_stat -if [[ ${builtins[stat]} != defined ]]; then - (( disable_stat = 1 )) - enable stat -fi +zmodload -F zsh/stat zstat 2>/dev/null || return 1 dir=${2:+$2/} dir=${(Q)dir} @@ -66,7 +58,7 @@ for f in ${(PQ)1}; do fi # Borrowed from Functions/Example/zls - stat -s -H stat -F "%b %e %H:%M" - "$dir$f" >/dev/null 2>&1 + zstat -s -H stat -F "%b %e %H:%M" - "$dir$f" >/dev/null 2>&1 listfiles+=("$stat[mode] ${(l:3:)stat[nlink]} ${(r:8:)stat[uid]} \ ${(r:8:)stat[gid]} ${(l:8:)stat[size]} $stat[mtime] $f") @@ -74,7 +66,4 @@ done (( ${#listfiles} )) && listopts=(-d listfiles -l -o) -} always { - (( disable_stat )) && disable stat -} return 0 diff --git a/Completion/Zsh/Command/_stat b/Completion/Zsh/Command/_stat index 5ba06388b..03e42e3af 100644 --- a/Completion/Zsh/Command/_stat +++ b/Completion/Zsh/Command/_stat @@ -1,4 +1,4 @@ -#compdef stat +#compdef stat zstat local expl ret=1 diff --git a/Completion/Zsh/Command/_zstyle b/Completion/Zsh/Command/_zstyle index 4090f0ac3..2bf2709ca 100644 --- a/Completion/Zsh/Command/_zstyle +++ b/Completion/Zsh/Command/_zstyle @@ -40,7 +40,6 @@ styles=( completer c:completer condition c:bool cursor c:cursor - disable-stat c:bool disabled c:bool domains c: expand c: diff --git a/Completion/Zsh/Type/_file_descriptors b/Completion/Zsh/Type/_file_descriptors index 6d21ed2b6..82d19d62a 100644 --- a/Completion/Zsh/Type/_file_descriptors +++ b/Completion/Zsh/Type/_file_descriptors @@ -7,9 +7,9 @@ for i in {0..9}; [[ -e /dev/fd/$i ]] && fds+=( $i ) if zstyle -T ":completion:${curcontext}:" verbose && [[ -e /proc/$$/fd ]]; then zstyle -s ":completion:${curcontext}:" list-separator sep || sep=-- - if zmodload -e zsh/stat; then + if zmodload -F zsh/stat zstat; then for i in "${fds[@]}"; do - stat +link -A link /proc/$$/fd/$i + zstat +link -A link /proc/$$/fd/$i list+=( "$i $sep ${link[1]}" ) done elif (( $+commands[readlink] )); then -- cgit 1.4.1