summaryrefslogtreecommitdiffstats
path: root/completions/zopfli
blob: 49d530589d6a9d25cf88bb7913f93bc466e64a2c (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
# bash completion for zopfli                               -*- shell-script -*-

_comp_cmd_zopfli()
{
    local cur prev words cword comp_args
    _comp_initialize -- "$@" || return

    case $prev in
        -h)
            return
            ;;
    esac

    if [[ $cur == -* ]]; then
        _comp_compgen -R help -- -h
        ((${#COMPREPLY[@]})) &&
            _comp_compgen -- -W '"${COMPREPLY[@]%#}"'
        [[ ${COMPREPLY-} == --i ]] && compopt -o nospace
        return
    fi

    _comp_compgen_tilde && return

    local xspec="*.@(gz|t[ag]z)"
    compopt -o filenames
    _comp_compgen -- -f -X "$xspec" -o plusdirs
} &&
    complete -F _comp_cmd_zopfli zopfli

# ex: filetype=sh