summaryrefslogtreecommitdiff
path: root/completions/pgrep
blob: 9e66fb95190e1094d0166e84a61fdc3a1a9b7249 (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
# pgrep(1) completion                                      -*- shell-script -*-

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

    case $prev in
        -d|-g|-s|-t)
            return
            ;;
        -G)
            _gids
            return
            ;;
        -P)
            _pids
            return
            ;;
        -u|-U)
            _uids
            return
            ;;
    esac

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

    _pnames
} &&
complete -F _pgrep pgrep

# Linux pidof(8) completion.
[[ $OSTYPE == *linux* ]] && complete -F _pgrep pidof

# ex: ts=4 sw=4 et filetype=sh