summaryrefslogtreecommitdiffstats
path: root/completions/pv
blob: ab3f070e6af1e7caf47e9e425a7f0fc78dd9af9c (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
# pv(1) completion                                         -*- shell-script -*-

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

    local noargopts='!(-*|*[VAFDiwHNLBRPd]*)'
    # shellcheck disable=SC2254
    case $prev in
        --help | --version | --last-written | --format | --delay-start | \
            --interval | --width | --height | --name | --rate-limit | \
            --buffer-size | -${noargopts}[hVAFDiwHNLB])
            return
            ;;
        --remote | -${noargopts}R)
            _comp_compgen_pids
            return
            ;;
        --pidfile | --watchfd | -${noargopts}[Pd])
            _comp_compgen_filedir pid
            return
            ;;
    esac

    if [[ $cur == -* ]]; then
        _comp_compgen_help
    else
        _comp_compgen_filedir
    fi
} &&
    complete -F _comp_cmd_pv pv

# ex: filetype=sh