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

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

    case $prev in
        --help|--version|--top|--include|--exclude|--single-policy|\
        --colo?(u)r-severity-*|--program-extensions|-[?HVs])
            return
            ;;
        --severity)
            COMPREPLY=( $(compgen -W "{1..5} brutal cruel harsh stern gentle" \
                                  -- "$cur") )
            return
            ;;
        --profile|-p)
            _filedir perlcriticrc
            return
            ;;
        --theme)
            COMPREPLY=( $(compgen -W '$("$1" --list-themes 2>/dev/null)' \
                                  -- "$cur") )
            return
            ;;
        --profile-strictness)
            COMPREPLY=( $(compgen -W 'warn fatal quiet' -- "$cur") )
            return
            ;;
        --verbose)
            COMPREPLY=( $(compgen -W '{1..11}' -- "$cur") )
            return
            ;;
        --pager)
            compopt -o filenames
            COMPREPLY=( $(compgen -c -- "$cur") )
            return
            ;;
    esac

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

    _filedir 'p[lm]'
} &&
complete -F _perlcritic perlcritic

# ex: filetype=sh