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

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

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

    if [[ $cur == -* ]]; then
        _comp_compgen_usage
        return
    fi

    _comp_compgen_filedir 'p[lm]'
} &&
    complete -F _comp_cmd_perlcritic perlcritic

# ex: filetype=sh