summaryrefslogtreecommitdiffstats
path: root/completions/pack200
blob: 1a6ded7ab24869d16fdf1add692027140ef0c248 (plain)
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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
# pack200(1) completion                                    -*- shell-script -*-

_pack200()
{
    local cur prev words cword split
    _init_completion -s || return

    case $prev in
        -S | --segment-limit | -P | --pass-file | -C | --class-attribute | \
            -F | --field-attribute | -M | --method-attribute | -D | --code-attribute | \
            '-?' | -h | --help | -V | --version | -J)
            return
            ;;
        -E | --effort)
            COMPREPLY=($(compgen -W '{0..9}' -- "$cur"))
            return
            ;;
        -H | --deflate-hint)
            COMPREPLY=($(compgen -W 'true false keep' -- "$cur"))
            return
            ;;
        -m | --modification-time)
            COMPREPLY=($(compgen -W 'latest keep' -- "$cur"))
            return
            ;;
        -U | --unknown-attribute)
            COMPREPLY=($(compgen -W 'error strip pass' -- "$cur"))
            return
            ;;
        -f | --config-file)
            _filedir properties
            return
            ;;
        -l | --log-file)
            COMPREPLY=($(compgen -W '-' -- "$cur"))
            _filedir log
            return
            ;;
        -r | --repack)
            _filedir jar
            return
            ;;
    esac

    $split && return

    # Check if a pack or a jar was already given.
    local i pack=false jar=false
    for ((i = 1; i < ${#words[@]} - 1; i++)); do
        case ${words[i]} in
            *.pack | *.pack.gz) pack=true ;;
            *.jar) jar=true ;;
        esac
    done

    if ! $pack; then
        if [[ $cur == -* ]]; then
            COMPREPLY=($(compgen -W '--no-gzip --gzip --strip-debug
                --no-keep-file-order --segment-limit= --effort= --deflate-hint=
                --modification-time= --pass-file= --unknown-attribute=
                --class-attribute= --field-attribute= --method-attribute=
                --code-attribute= --config-file= --verbose --quiet --log-file=
                --help --version -J --repack' -- "$cur"))
            [[ ${COMPREPLY-} == *= ]] && compopt -o nospace
        else
            _filedir 'pack?(.gz)'
        fi
    elif ! $jar; then
        _filedir jar
    fi
} &&
    complete -F _pack200 pack200

# ex: filetype=sh