~ubuntu-branches/ubuntu/utopic/zsh/utopic-proposed

« back to all changes in this revision

Viewing changes to Completion/Unix/Command/_lha

  • Committer: Package Import Robot
  • Author(s): Dmitrijs Ledkovs
  • Date: 2013-08-02 13:37:21 UTC
  • mfrom: (35.1.1 sid)
  • Revision ID: package-import@ubuntu.com-20130802133721-3j6vii96vovrdwoc
Tags: 5.0.2-3ubuntu1
* Merge from Debian, remaining changes - support cross-compiling:
  - Adjust upstream autoconf cross-compile default fallbacks.
  - Skip zcompile when cross-compiling.
  - Add libelf-dev dependency.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#compdef lha
 
2
 
 
3
if (( CURRENT == 2 )); then
 
4
    compset -P -
 
5
 
 
6
    local lhacmds
 
7
    lhacmds=(
 
8
        '(  x l v u d m c p t)a[Add \(Or replace\) to archive]'
 
9
        '(a   l v u d m c p t)x[EXtract from archive]'
 
10
        '(a x   v u d m c p t)l[List]'
 
11
        '(a x l   u d m c p t)v[Verbose List]'
 
12
        '(a x l v   d m c p t)u[Update newer files to archive]'
 
13
        '(a x l v u   m c p t)d[Delete from archive]'
 
14
        '(a x l v u d   c p t)m[Move to archive]'
 
15
        '(a x l v u d m   p t)c[re-Construct new archive]'
 
16
        '(a x l v u d m c   t)p[Print to STDOUT from archive]'
 
17
        '(a x l v u d m c p  )t[Test file CRC in archive]'
 
18
    )
 
19
 
 
20
    if [ "${words[2]#-}" != "" ]; then
 
21
        lhacmds=($lhacmds
 
22
            'v[verbose]'
 
23
            'q[quiet]'
 
24
            'n[not execute]'
 
25
            'f[force\(over write at extract\)]'
 
26
            't[FILES are TEXT file]'
 
27
            'e[TEXT code convert from/to EUC]'
 
28
            'g[Generic format \(for compatibility\)]'
 
29
        )
 
30
        case ${words[2]#-} in
 
31
            a*|u*)
 
32
                lhacmds=($lhacmds
 
33
                    'd[delete FILES after]'
 
34
                    'z[files not compress]'
 
35
                    '(  1 2)0[header level 0]'
 
36
                    '(0   2)1[header level 1]'
 
37
                    '(0 1  )2[header level 2]'
 
38
                )
 
39
                ;;
 
40
            c*)
 
41
                lhacmds=($lhacmds 'd[delete FILES after]')
 
42
                ;;
 
43
            x*)
 
44
                lhacmds=($lhacmds 'i[ignore directory path]')
 
45
                ;;
 
46
        esac
 
47
    fi
 
48
 
 
49
    _values -s '' 'lha command' \
 
50
        $lhacmds \
 
51
        && return 0
 
52
elif (( CURRENT == 3 )); then
 
53
    _arguments -C \
 
54
        '*:LHA file:_files -g \*.lzh' && return 0
 
55
else
 
56
    case ${words[2]#-} in
 
57
        l*|x*|d*)
 
58
            if [ -f "$words[3]" ]; then
 
59
                _lzh_cache_list=`$words[1] lq $words[3] | awk '{print $8}'`
 
60
                _lzh_cache_list=("${(@f)${_lzh_cache_list}}")
 
61
                
 
62
                _wanted files expl 'file from archive' _multi_parts / _lzh_cache_list
 
63
 
 
64
                return 0
 
65
            else
 
66
                _message -r "Archive file is not found : ${words[3]}"
 
67
                return 1
 
68
            fi
 
69
                
 
70
            ;;
 
71
        *)
 
72
            _arguments -C \
 
73
                '*:file:_files' && return 0
 
74
    esac
 
75
fi
 
76
 
 
77
return 0