summary refs log tree commit diff
path: root/Completion/AIX/_lsdev
blob: 1bb1a88029ce3bab4dd6939e36f1bdf341302012 (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
#compdef lsdev

local curcontext="${curcontext}" state line expl

_arguments -C \
  '(-P)-C[list info about device in customized devices object class]' \
  '(-C -l)-P[list info about device in predefined object class]' \
  '-c[specify a device class]:device class:->class' \
  '-f[read flags from file]:files:_files' \
  '-F[specify output format]:format:->columnname' \
  '-H[display headers above columns]' \
  '-h[display command usage]' \
  '(-P)-l[specify device logical name]:device logical name' \
  '-r[display set of values in a column]:columnname:->columnname' \
  '(-P)-S[specify a device state]:device state:(Available Defined Stopped)' \
  '-s[specify a device subclass]:device subclass:->subclass' \
  '-t[specify a device type name]:device type name:->devtype' && return 0

case $state in
  class)
    _wanted devclass expl 'device class names' \
        compadd - $(lsdev ${words[(r)-[CP]]:--P} -r class)
  ;;
  subclass)
    _wanted devsubclass expl 'device subclass names' \
        compadd - $(lsdev ${words[(r)-[CP]]:--P} -r subclass)
  ;;
  devtype)
    _wanted devtype expl 'device type names' \
        compadd - $(lsdev ${words[(r)-[CP]]:--P} -r type)
  ;;
  columnname)
    [[ $words[CURRENT-1] = -F ]] && compset -P '*[^a-zA-Z]'
    _wanted devcolumnname expl 'column names' \
        compadd - ${(s: :)words[(r)-C]:+name status location} \
	  class subclass description type
  ;;
esac