about summary refs log tree commit diff
path: root/Completion/Zsh/Command
diff options
context:
space:
mode:
authorDaniel Shahaf <d.s@xxxxxxxxxxxxxxxxxx>2017-10-07 01:03:18 +0000
committerDaniel Shahaf <d.s@daniel.shahaf.name>2017-10-11 17:50:30 +0000
commit57cfa8b160d16a37fcd6a5da7c8bcd492c76021e (patch)
tree318f997fd71db7b50fd79692cad8f790fcb48c99 /Completion/Zsh/Command
parentc68cfb1c36513e30ec5896444487694dcd4e12b6 (diff)
downloadzsh-57cfa8b160d16a37fcd6a5da7c8bcd492c76021e.tar.gz
zsh-57cfa8b160d16a37fcd6a5da7c8bcd492c76021e.tar.xz
zsh-57cfa8b160d16a37fcd6a5da7c8bcd492c76021e.zip
41825/0002: _stat: Complete -x options to zsh/stat's 'zstat'.
Diffstat (limited to 'Completion/Zsh/Command')
-rw-r--r--Completion/Zsh/Command/_stat36
1 files changed, 21 insertions, 15 deletions
diff --git a/Completion/Zsh/Command/_stat b/Completion/Zsh/Command/_stat
index 303775b23..73bbef471 100644
--- a/Completion/Zsh/Command/_stat
+++ b/Completion/Zsh/Command/_stat
@@ -2,24 +2,30 @@
 
 local expl ret=1
 
-if [[ "$words[CURRENT-1]" = -[AH] ]]; then
-  _arrays
-elif [[ $service == zstat ]] ||
+if [[ $service == zstat ]] ||
      (( ${+builtins[stat]} )) || 
      { (( ! ${+builtins} )) && [[ $(type -w stat) == '*: builtin' ]] }
 then
-  _tags files options || return 1
-
-  while _tags; do
-    _requested files && _files && ret=0
-    _requested options &&
-        { ! zstyle -T ":completion:${curcontext}:options" prefix-needed ||
-          [[ "$PREFIX[1]" = + || ret -eq 1 ]] } &&
-        _all_labels options expl 'inode element' \
-            compadd - +device +inode +mode +nlink +uid +gid +rdev \
-                      +size +atime +mtime +ctime +blksize +block +link
-    (( ret )) || return 0
-  done
+  _arguments -s -S : \
+    '(-H)-A[assign the results to array, don'\''t print]:array variable:_parameters -g "*array*"' \
+    - set1 \
+    +device +inode +mode +nlink +uid +gid +rdev \
+    +size +atime +mtime +ctime +blksize +block +link \
+    '(-A)-H[assign the results to associative array, don'\''t print]:associative array variable:_parameters -g "*association*"' \
+    '(:)-f[stat a file descriptor]:file descriptor:_file_descriptors' \
+    '(-s)-F:strftime(3) format string:_date_formats zsh' \
+    '(-s)-g[show times in GMT/UTC]' \
+    '-L[don'\''t dereference symbolic links; use lstat(2)]' \
+    '(-N)-n[always show names of files]' \
+    '(-n)-N[never show names of files]' \
+    '-o[print file modes in octal rather than decimal]' \
+    '-r[print raw data]' \
+    '-s[print mode,uid,gid and times as strings]' \
+    '(-T)-t[always show type names]' \
+    '(-t)-T[never show type names]' \
+    '*:files to stat:_files' \
+    - set2 \
+    '-l[list stat types]'
 else
   # TODO: system-specific completion
   # TODO: choose this codepath if 'command stat ...' or '=stat ...' is used