about summary refs log tree commit diff
path: root/Completion/Unix/Command/_mknod
blob: 8f07328db86b4ca8eb12442b1a9481b8eee74d66 (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
#compdef mknod gmknod

# - @todo Major/minor device numbers could be completed using /proc/devices on
#   Linux and e.g. `stat -f %Hr /dev/*` on BSD/Darwin
# - @todo Device numbers should not be completed given p or w types

local -a aopts args

if _pick_variant gnu='Free Soft' $OSTYPE --version; then
  args=(
    '(: * -)--help[display help information]'
    '(: * -)--version[display version information]'
    '(-m --mode)'{-m+,--mode=}'[specify file mode]: :_file_modes'
    '1:special file:_files'
    '2:special file type:((
      b\:"block (buffered) special file"
      {c,u}\:"character (unbuffered) special file"
      p\:FIFO
    ))'
    '3:major device number'
    '4:minor device number'
  )
  [[ $OSTYPE == linux* ]] && args+=(
    '(--context)-Z[set SELinux security context to default]'
    '(-Z)--context=-[like -Z, or specify SELinux security context]::SELinux security context:_selinux_contexts'
  )
else
  aopts=( -A '-*' )
  args=(
    '-F+[specify device-number format]:device-number format:(
      native 386bsd 4bsd bsdos freebsd hpux isc linux netbsd osf1 sco solaris
      sunos svr3 svr4 ultrix
    )'
    '1:special file:_files'
    '2:special file type:((
      b\:"block-type device"
      c\:"character-type device"
      w\:"whiteout node"
    ))'
    '3:major device number'
    '4:minor device number'
  )
fi

_arguments -s -S $aopts : $args