summary refs log tree commit diff
path: root/Completion/Zsh/Command/_zattr
blob: e48047f6c218394af2be0e0cffadb2894bcb17a2 (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
#compdef zgetattr zsetattr zdelattr zlistattr

local context state line expl ret=1 REPLY

case $service in
zgetattr)
_arguments \
  '1:file:_files' \
  '2:attribute:->attrs' \
  '3:parameter'
;;
zsetattr)
_arguments \
  '1:file:_files' \
  '2:attribute:->attrs' \
  '3:value'
;;
zdelattr)
_arguments \
  '1:file:_files' \
  '2:attribute:->attrs'
;;
zlistattr)
_arguments \
  '1:file:_files' \
  '2:parameter'
;;
esac && ret=0

if [[ $state = attrs ]]; then
  zlistattr ${(Q)${~line[1]}} REPLY 2> /dev/null
  _wanted -C "$context[1]" attrs expl 'attribute' compadd -a REPLY && ret=0
fi

return ret