blob: 03abe88a3f2b1286009db1f099c2e71b59ae3102 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
|
#compdef stat gstat zstat
# Notes:
# - @todo It would be nice to complete the -c/-f format strings some day
# - @todo It should be possible to complete NFS file handles on FreeBSD and
# Dragonfly by parsing the output of `lsof -N`, but it's not available by
# default — is there another way?
local expl variant ret=1
local -a context line state state_descr args aopts=( -A '-*' )
local -A opt_args
_pick_variant -r variant -b zsh gnu='Free Soft' $OSTYPE --version
case $variant in
zsh)
args=(
"(-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 the specified file descriptor]:file descriptor:_file_descriptors'
'(-s)-F[specify strftime(3) format string]: :_date_formats zsh'
'(-s)-g[show times in GMT/UTC]'
# Note that this has the *opposite* effect of other variants' -L option!
"-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]'
'(-o)-s[print mode, UID, GID, and times as strings]'
'(-T)-t[always show type names]'
'(-t)-T[never show type names]'
'*: :_files'
- set2
'-l[list stat types]'
)
;;
gnu)
aopts=( )
args=(
'*: :_files'
'(: * -)--help[display help information]'
'(: * -)--version[display version information]'
'(-L --dereference)'{-L,--dereference}'[dereference symbolic links]'
+ '(d)' # Display options
{-c+,--format=}'[display per the specified format string]:format string'
{-f,--file-system}'[display file-system status instead of file status]'
'--printf=[display as with -c, but interpret backslash escapes like printf(3)]'
{-t,--terse}'[display in terse format]'
)
;;
darwin*|dragonfly*|*bsd*)
args=(
'*: :->files-or-handles'
'(-H)-L[dereference symbolic links]'
'-q[suppress error messages about lstat(2)/stat(2) failure]'
+ '(d)' # Primary display options
'(-F)-f+[display per the specified format string]:format string'
'-l[display in `ls -lT` format]'
'(-F -t)-r[display in raw (numerical) format]'
'(-F -t)-s[display in shell variable-assignment format]'
'(-F)-x[display in verbose (Linux-style) format]'
+ D # Secondary display options
'(-f -r -s -x)-F[append file type indicators (implies -l)]'
'-n[suppress terminating newlines]'
'(-r -s)-t+[specify strftime(3) format string]: :_date_formats'
)
;| # MATCH AGAIN
dragonfly*|freebsd*)
args+=(
+ df
'(-L)-H[treat arguments as hexadecimal-formatted NFS file handles]'
)
;;
esac
(( $#args )) || args=( '*: :_files' )
_arguments -s -S $aopts : $args && ret=0
[[ $state == files-or-handles ]] &&
if [[ -n ${opt_args[(i)*--H]} ]]; then
_message -e nfs-handles 'NFS file handle'
else
_files && ret=0
fi
return ret
|