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 ++------------- 4 files changed, 13 insertions(+), 33 deletions(-) (limited to 'Completion/Unix') 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 -- cgit 1.4.1