about summary refs log tree commit diff
path: root/Completion/User/_bzip2
blob: f0fd23f90670be09361ec13a0814f4a006bae8b6 (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
#compdef bzip2 bzcat bunzip2 bzip2recover

local decompress expl state line
typeset -A opt_args

case "${words[1]:t}" in
  bzip2recover) [[ $CURRENT = 2 ]] && state=files;;
  bzip2) decompress=no;&
  bunzip2|bzcat) _arguments -C -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'
  ;;
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'
  else
    _description files expl 'file to compress'
    _files "$expl[@]" -g '*~*.bz2'
  fi
fi