aboutsummaryrefslogtreecommitdiff
path: root/zsh-completion/_paludis
blob: 1f069d850ccca8fb5f45e2dca4a3c22315f395dc (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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
#compdef paludis

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

_paludis() {
    local actions action_args query_args general_args deplist_args install_uninstall_args list_args lists owner_args
    actions=( --query --install -i --uninstall -u --sync -s --report --contents -k --owner -o --version -V --info -I --help -h \
    --has-version  --best-version --environnement-variable --list-repositories --list-categories --list-packages --list-sets --list-sync-protocols --list-repository-formats --list-dep-tag-categories --regenerate-installed-cache  --update-news --regenerate-installable-cache)

    query_args=(
        '(--show-deps -D)'{--show-deps,-D}"[Show dependencies]"
        '(--show-metadata -M)'{--show-metadata,-M}"[Show raw metadata]"
    )

    install_uninstall_args=(
        '(--pretend -p)'{--pretend,-p}"[Pretend only]"
        '(--preserve-world -1)'{--preserve-world,-1}"[Don t modify the world file]"
        '--no-config-protection[Disable config file protection (dangerous)]'
        '--debug-build[What to do with debug information]:Debug Build:(( none\:Discard\ debug\ information split\:Split\ debug\ information internal\:Keep\ debug\ information\ with\ binaries ))'
        '(--fetch -f)'{--fetch,-f}'[Only fetch sources; don t install anything]'
        '--show-reasons[Show why packages are being (un)installed]:Verbosity:((none\:Don\ t\ show\ any\ information summary\:Show\ a\ summary full\:Show\ full\ output))'
        '--with-unused-dependencies[Also uninstall any dependencies of the target that are no longer used]'
        '--with-dependencies[Also uninstall packages that depend upon the target]'
        '--show-use-descriptions[Show descriptions of USE flags]:case to show:((none\:Don\ t\ show\ any\ descriptions new\:Show\ for\ new\ use\ flags changed\:Show\ for\ new\ and\ changed\ flags all\:Show for all flags))'
        '--add-to-world-atom[Use this atom, rather than all targets, for updating world (for resume commands)]'
    )
    list_args=(
        '--repository[Matches with this repository name only]:repository:_paludis_packages repositories'
        '--category[Matches with this category name only]:category:_paludis_packages category'
        '--package[Matches with this package name only]:package:_paludis_packages available'
        '--set[Matches with this package set name only]:set:_paluldis_packages set'
    )

    lists=(
        '(: -)--list-repositories[List available repositories]'
        '(: -)--list-categories[List available categories]'
        '(: -)--list-packages[List available packages]'
        '(: -)--list-sets[List available package sets]'
        '(: -)--list-sync-protocols[List available sync protocols]'
        '(: -)--list-repository-formats[List available repository formats]'
        '(: -)--list-dep-tag-categories[List known dep tag categories]'
    )
    general_args=(
        '--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]"
        '(--config-suffix -c)'{-c,--config-suffix}"[Config directory suffix]"
    )
    
    action_args=(
        "($actions)"{-q,--query}"[Query for package information]" 
        "($actions)"{-i,--install}"[Install one or more packages]"
        "($actions)"{-u,--uninstall}"[Uninstall one or more packages]"
        "(: -)"{--sync,-s}"[Sync all or specified repositories]:repository:_paludis_packages repositories"
        "($actions)--uninstall-unused[Uninstall unused packages]"
        "(: -)"{--report,-r}"[Report the current state of the system]"
        "(: -)"{--contents,-k}"[Display contents of a package]:package:_paludis_packages installed"
        "(: -)"{--owner,-o}"[Display the owner of a file]"
        "(: -)"{--version,-V}"[Display program version]"
        "(: -)"{--info,-I}"[Display program version and system information]"
        "(: -)"{--help,-h}"[Display program help]"
        "(: -)--has-version[Check whether the specified atom is installed]:package:_paludis_packages available"
        "(: -)--best-version[Display the best version of the specified atom]:package _paludis_packages available"
        "(: -)--environment-variable[Display the value of an environment variable for a particular package]:package:_paludis_packages available"
        "(: -)--configuration-variable[Display the value of a configuration variable for a particular repository]:_paludis_packages repositories"
        "(: -)--update-news[Regenerate news.unread files]"
        "(: -)--regenerate-installed-cache[Regenerate (non-metadata) cache for installed repositories]"
        "(: -)--regenerate-installable-cache[Regenerate (non-metadata) cache for installable repositories]"
    )
    owner_args=(
        "--full-match[Match whole filename]"
    )
    deplist_args=(
        "--dl-reinstall[When to reinstall packages]:When:(never always if-use-changed)"
        "--dl-reinstall-scm[When to reinstall scm packages]:When:(never always daily weekly)"
        "--dl-upgrade[When to upgrade packages]:When:(always as-needed)"
        "--dl-deps-default[Override default behaviour for all dependency classes]:How::How:(pre pre-or-post post try-post discard)"
        "--dl-installed-deps-pre[How to handle pre dependencies for installed packages]:How:(pre pre-or-post post try-post discard)"
        "--dl-installed-deps-runtime[How to handle runtime dependencies for installed packages]:How:(pre pre-or-post post try-post discard)"
        "--dl-installed-deps-post[How to handle post dependencies for installed packages]:How:(pre pre-or-post post try-post discard)"
        "--dl-uninstalled-deps-pre[How to handle pre dependencies for uninstalled packages]:How:(pre pre-or-post post try-post discard)"
        "--dl-uninstalled-deps-post[How to handle post dependencies for uninstalled packages]:How:(pre pre-or-post post try-post discard)"
        "--dl-circular[How to handle circular dependencies]:How:(error discard)"
        "--dl-fall-back[When to fall back to installed packages]:When:(as-needed-except-targets as-needed never)"
        "--dl-new-slots[When to pull in new slots (works with --dl-upgrade)]:When:(always as-needed)"
    )
    #dispatch
    if (( $words[(I)(--(uninstall)|-[[:alpha:]]#(u)[[:alpha:]]#)] )) ; then
        _arguments -s \
                $general_args[@] $deplist_args[@] $install_uninstall_args[@] \
            "*:installed package:_paludis_packages installed" && return 0
    elif (( $words[(I)--uninstall-unused] )) ; then
            _arguments -s \
                $deplist_args[@] $install_uninstall_args[@] && return 0
    elif (( $words[(I)(--(owner)|-[[:alpha:]]#(o)[[:alpha:]]#)] )) ;then
        _arguments -s \
                $general_args[@] $owner_args[@]\
                "*:Files:_files" && return 0
    elif (( $words[(I)(--(install)|-[[:alpha:]]#(i)[[:alpha:]]#)] )) ;then
        _arguments -s \
                $general_args[@] $deplist_args[@] $install_uninstall_args[@] \
            "*:available packages:_paludis_packages available" && return 0
    elif (( $words[(I)(--(query)|-[[:alpha:]]#(q)[[:alpha:]]#)] )) ;then
        _arguments -s \
                $general_args[@] $query_args[@]\
            "*:available packages:_paludis_packages available" && return 0
    elif (( $words[(I)--(repository|package|category|set)] ));then
        _arguments \
            $lists[@] && return 0
    else
        _arguments -s \
            $general_args[@] $deplist_args[@] $list_args[@] $lists[@] $install_uninstall_args[@] "$action_args[@]" && return 0
    fi
}

_paludis "$@"