about summary refs log tree commit diff
path: root/Completion/Unix/Command/_bzip2
blob: cbce91ad6ced41a0ea096aea9c2898750ce2f0aa (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
#compdef bzip2 bunzip2 bzcat=bunzip2 bzip2recover -redirect-,<,bunzip2=bunzip2 -redirect-,>,bzip2=bunzip2 -redirect-,<,bzip2=bzip2

local decompress expl state line curcontext="$curcontext"
typeset -A opt_args

case "$service" in
  bzip2recover) [[ $CURRENT = 2 ]] && state=files;;
  bzip2) decompress=no;&
  bunzip2) _arguments -C -s -S \
    '(--help)-h[display help message]' \
    '(-h)--help[display help message]' \
    '(--decompress --compress -z --test -t)-d[decompress]' \
    '(-d --compress -z --test -t)--decompress[decompress]' \
    '(--compress --decompress -d --test -t)-z[compress]' \
    '(-z --decompress -d --test -t)--compress[compress]' \
    "(--keep)-k[keep (don't delete) input files]" \
    "(-k)--keep[keep (don't delete) input files]" \
    '(--force)-f[force overwrite]' \
    '(-f)--force[force overwrite]' \
    '(--test --decompress -d --compress -z )-t[test compressed file integrity]' \
    '(-t --decompress -d --compress -z )--test[test compressed file integrity]' \
    '(--stdout)-c[write on standard output]' \
    '(-c)--stdout[write on standard output]' \
    '(--quiet)-q[suppress all warnings]' \
    '(-q)--quiet[suppress all warnings]' \
    '*-v[verbose mode]' \
    '*--verbose[verbose mode]' \
    '(--license)-L[display software license]' \
    '(-L)--license[display software license]' \
    '(--version)-V[display version number]' \
    '(-V)--version[display version number]' \
    '(--small)-s[use less memory (at most 2500k)]' \
    '(   -2 -3 -4 -5 -6 -7 -8 -9)-1' \
    '(-1    -3 -4 -5 -6 -7 -8 -9)-2' \
    '(-1 -2    -4 -5 -6 -7 -8 -9)-3' \
    '(-1 -2 -3    -5 -6 -7 -8 -9)-4' \
    '(-1 -2 -3 -4    -6 -7 -8 -9)-5' \
    '(-1 -2 -3 -4 -5	-7 -8 -9)-6' \
    '(-1 -2 -3 -4 -5 -6    -8 -9)-7' \
    '(-1 -2 -3 -4 -5 -6 -7    -9)-8' \
    '(-1 -2 -3 -4 -5 -6 -7 -8	)-9' \
    '*:files:->files' && return 0
  ;;
esac

if [[ "$state" = files ]]; then
  (( $+opt_args[-z] || $+opt_args[--compress] )) && decompress=no
  (( $+opt_args[-d] || $+opt_args[--decompress] || $+opt_args[-t] ||
      $+opt_args[--test] )) && unset decompress
  if [[ -z "$decompress" ]]; then
    _description files expl 'compressed file'
    _files "$expl[@]" -g '*.(bz2|tbz|tbz2)' && return 0
  else
    _description files expl 'file to compress'
    _files "$expl[@]" -g '*~*.(bz2|tbz|tbz2)' && return 0
  fi
fi

return 1