summaryrefslogtreecommitdiff
path: root/completions/optipng
blob: 0f6b40e110816389f190b90db49d83a397a9c7cb (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
# optipng(1) completion                                    -*- shell-script -*-

_optipng()
{
    local cur prev words cword
    _init_completion || return

    case $prev in
        -'?' | -h | --help | -f)
            return
            ;;
        -o)
            COMPREPLY=($(compgen -W '{0..7}' -- "$cur"))
            return
            ;;
        -out | -log)
            _filedir
            return
            ;;
        -dir)
            _filedir -d
            return
            ;;
        -i)
            COMPREPLY=($(compgen -W '0 1' -- "$cur"))
            return
            ;;
        -zc | -zm)
            COMPREPLY=($(compgen -W '{1..9}' -- "$cur"))
            return
            ;;
        -zw)
            COMPREPLY=($(compgen -W '256 512 1k 2k 4k 8k 16k 32k' \
                -- "$cur"))
            return
            ;;
        -strip)
            COMPREPLY=($(compgen -W 'all' -- "$cur"))
            return
            ;;
    esac

    if [[ $cur == -* ]]; then
        COMPREPLY=($(compgen -W '$(_parse_help "$1")' -- "$cur"))
        return
    fi

    _filedir '@(png|bmp|gif|pnm|tif?(f))'
} &&
    complete -F _optipng optipng

# ex: filetype=sh