aboutsummaryrefslogtreecommitdiff
path: root/zsh-completion/_adjutrix
blob: 79a885f802a53e928cc15ac3af111cc41231d3e4 (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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
#compdef adjutrix

# vim: set et sw=4 sts=4 ts=4 ft=zsh :
# ZSH completion for adjutrix
# Written by Baptiste Daroussin <baptux at free.fr>

_adjutrix() {
    local actions tree_options profile_options general_options actions_args arches
    actions=(
        --what-needs-keywording -w
        --find-stable-candidates -s
        --find-dropped-keywords -d 
        --find-insecure-packages -i
        --find-unused-packages -U
        --keyword-graph -k
        --reverse-deps -r
        --display-profiles-use -u
        --display-default-system-resolution -S
        --build-downgrade-check-list
        --downgrade-check
        --version -V
        --help -h
    )
    arches=(alpha amd64 arm hppa ia64 m68k mips ppc ppc64 ppc-macos s390 sh sparc sparc-fbsd x86 x86-fbsd)
    tree_options=(
        '(--category -C)'{--category,-C}'[Matches with this category name only (may be specified multiple times)]:Category:'
        '(--package -P)'{--package,-P}'[Matches with this package name only (may be specified multiple times)]:Packages:'
    )
    profile_options=(
        '--profile[Display results for this profile path, rather than all profiles (may be specified multiple times)]:Profile:_files -/'
        '--unstable[Accept ~arch as well as arch]'
    )
    general_options=(
        '--log-level[Specify the log level]:log level:((debug\:Show\ debug\ output qa\:Show\ QA\ messages\ and\ warnings\ only warning\:Show\ warnings\ only silent\:Suppress\ all\ log\ messages))' 
        '(--no-colour --no-color)'{--no-colour,--no-color}"[Do not use colour]"
        '(--repository-dir -D)'{--repository-dir,-D}'[Where to find the repository]:repository:_files -/'
    )
    action_args=(
        "($actions)"{--what-needs-keywording,-w}"[Display what needs to be done to keyword a target]:arch:($arches)"
        "($actions)"{--find-unused-packages,-U}"[Search package versions that can probably safely be removed]"
        "($actions)"{--find-stable-candidates,-s}"[Search for stable package candidates]:arch:($arches)"
        "($actions)"{--find-dropped-keywords,-d}"[Search for packages where keywords have been dropped]:arch:($arches)"
        "($actions)"{--find-insecure-packages,-i}"[Search for packages marked as insecure by a GLSA]"
        "($actions)"{--keyword-graph,-k}"[Display keywords graphically]"
        "($actions)"{--reverse-deps,-r}"[all package that depend on a given dep spec]:Packages:"
        "($actions)"{--display-profiles-use,-u}"[Display USE information for all profiles]"
        "($actions)"{--display-default-system-resolution,-S}"[Display package names and versions that are included in the default resolution of the system set]"
        "($actions)"{--build-downgrade-check-list}"[Build the downgrade check lists]"
        "($actions)"{--downgrade-check}"[Perform the dowgrade check]"
        "(: -)"{--version,-V}"[Display program version]"
        "(: -)"{--help,-h}"[Display program help]"
    )
    if (( $words[(I)(--(find-stable-candidates|find-dropped-keywords|find-insecure-packages|keyword-graph|reverse-deps)|-[[:alpha:]]#(s|d|i|k|r)[[:alpha:]]#)] ));then
            _arguments -s \
            $general_options[@] $tree_options[@] && return 0
    elif (( $words[(I)(--(display-profiles-use|display-default-system-resolution)|-[[:alpha:]]#(u|S)[[:alpha:]]#)] ));then
        _arguments -s \
        $general_options[@] $profile_options[@] && return 0
    else
        _arguments -s \
        $general_options[@] $profile_options[@] $tree_options[@] $action_args[@] && return 0
    fi
}

_adjutrix "$@"