summary refs log tree commit diff
path: root/Completion/Unix/Command/_cmp
blob: 6d7bfb1b7e9ae541ea1067efba49ef2c886dddcf (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
#compdef cmp gcmp

local args variant
_pick_variant -r variant gnu=GNU $OSTYPE --version

case $variant in
  gnu)
    args=(
      '(-b --print-bytes)'{-b,--print-bytes}'[print differing bytes]'
      '(-i --ignore-initial)'{-i+,--ignore-initial}'[skip specified number of bytes]:bytes'
      '(-l --verbose -s --silent --quiet)'{-l,--verbose}'[output all differences]'
      '(-n --bytes)'{-n+,--bytes=}'[specify maximum bytes to compare]:bytes'
      '(-s --quiet --silent -l --verbose)'{-s,--quiet,--silent}'[return status alone signifies differences]'
      '(- *)'{-v,--version}'[display version information]'
      '(- *)--help[display help information]'
    )
  ;;
  netbsd*) args+=( "-c[don't use mmap]" ) ;|
  freebsd*|openbsd*)
    args=(
      "-h[don't follow symbolic links]"
      '-x[hexadecimal output and zero based offset index]'
      '-z[compare file sizes first]'
    )
  ;&
  *)
    args+=(
      '(-s)-l[output all differences]'
      '(-l)-s[silent: return status alone signifies differences]'
    )
  ;;
esac

_arguments -s $args '1:file 1:_files' '2:file 2:_files' '::byte offset' '::byte offset'