aboutsummaryrefslogtreecommitdiff
path: root/zsh-completion/_paludis
blob: f3fb939be5260c5c9086a4f2fb31389ce9cfc693 (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
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
#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_descriptions deplist_args install_uninstall_args list_args lists owner_args
    actions=(
        --query --install -i --uninstall -u --uninstall-unused --sync -s --report --contents -k --executables --owner -o --config
        --version -V --info -I --help -h -has-version --best-version --environment-variable --list-repositories --list-categories --list-packages --list-sets 
        --list-sync-protocols --list-repository-formats --list-dep-tag-categories --regenerate-installed-cache --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]"
        "(--destinations -d)"{--destinations,-d}"[Use specified destinations instead of defaults]:Destinations:_paludis_packages repositories"
        "(--preserve-world -1)"{--preserve-world,-1}"[Don't modify the world file]"
        "--add-to-world-spec[Use this atom, rather than all targets, for updating world (for resume commands)]"
        "(--fetch -f)"{--fetch,-f}"[Only fetch sources; don't install anything]"
        "--no-safe-resume[Do not allow interrupted downloads to be resumed]"
        "--show-reasons[Show why packages are being (un)installed]:Verbosity:((none\:Don\'t\ show\ any\ information summary\:Show\ a\ summary full\:Show\ full\ output))"
        "--show-use-descriptions[Show descriptions of USE flags]:Which:((none\:Don\'t\ show\ any\ descriptions new\:Show\ for\ new\ use\ flags changed\:Show\ for\ new\ and\ changed\ flags all\:Show for all flags))"
        "--show-package-descriptions[Show package descriptions]:When:((none\:Don\'t\ show\ any\ descriptions new\:Show\ descriptions\ for\ new\ packages all\:Show\ descriptions\ for\ all\ packages))"
        "--continue-on-failure[Whether to continue after a fetch or install error]:When:((if-fetch-only\:If\ fetching\ only never\:Never if-satisfied\:If\ remaining\ packages\ dependencies\ are\ satisfied if-independent\:If\ independent\ of\ failed\ and\ skipped\ packages always\:Always))"
        "--skip-phase[Skip phases with a given name]:Phase: "
        "--abort-at-phase[Abort when a phase with a given name is encountered]:Phase: "
        "--skip-until-phase[Skip all phases until a phase with a given name is encountered]:Phase: "
        "--change-phases-for[Control which packages to change phases for]:Target:((all\:'All packages' first\:'Only the first package on the list' last\:'Only the last package on the list'))"
    )
    list_args=(
        "--repository-format[Matches with this repository format only]:format:_paludis_packages repository-formats"
        "--repository[Matches with this repository name only]:repository:_paludis_packages repositories"
        "--category[Matches with this category name only]:category:_paludis_packages categories"
        "--package[Matches with this package name only]:package:_paludis_packages available"
        "--set[Matches with this package set name only]:set:_paludis_packages sets"
    )
    uninstall_args=(
        "--with-unused-dependencies[Also uninstall any dependencies of the target that are no longer used]"
        "--permit-unsafe-uninstalls[Permit depended-upon packages to be uninstalled]"
        "--with-dependencies[Also uninstall packages that depend upon the target]"
        "--all-versions[Uninstall all versions of a package]"
    )
    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 (noisy)" qa\:"Show QA messages and warnings only (default)" warning\:"Show warnings only" silent\:"Suppress all log messages (UNSAFE)"))'
        "(--no-colour)--force-colour[Force the use of colour]"
        "(--force-colour)--no-colour[Do not use colour]"
        "--no-suggestions[Do not give suggestions if an unknown name is specified]"
        "(--environment -E)"{-E,--environment}"[Environment specification]"
        "--resume-command-template[Save the resume command to a file made using mkstemp(3)]:file:_files"
        "--compact[Display output using one line per entry]"
    )

    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"
        "(: -)"--executables"[Display executable 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 spec is installed]:package:_paludis_packages available"
        "(: -)--best-version[Display the best version of the specified spec]: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]:repository:_paludis_packages repositories"
        "(: -)--update-news[Regenerate news.unread files]"
        "(: -)--regenerate-installed-cache[Regenerate (non-metadata) cache for installed repositories]:repository:_paludis_packages repositories"
        "(: -)--regenerate-installable-cache[Regenerate (non-metadata) cache for installable repositories]:repository:_paludis_packages repositories"
        "(: -)--config[Run post-install configuration for a package]:package:_paludis_packages installed"
    )
    owner_args=(
        "--full-match[Match whole filename]"
    )
    deplist_descriptions='
        pre\:"As pre dependencies"
        pre-or-post\:"As pre dependencies, or post dependencies where needed"
        post\:"As post dependencies"
        try-post\:"As post dependencies, with no error for failures"
        discard\:"Discard (default)"'
    deplist_args=(
        "--dl-blocks[How to handle blocks]:How:(accumulate error discard)"
        "--dl-override-masks[Zero or more mask kinds that can be overridden as necessary]:What:((none tilde-keyword unkeyworded profile repository license))"
        "--dl-suggested[How to handle suggested dependencies]:How:((show install discard))"
        "--dl-downgrade[When to downgrade packages]:When:((as-needed warning error))"
        "--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-reinstall-targets[When to reinstall targets]:When:((auto never always))"
        "--dl-upgrade[When to upgrade packages]:When:((always as-needed))"
        "--dl-deps-default[Override default behaviour for all dependency classes]:How:(($deplist_descriptions))"
        "--dl-installed-deps-pre[How to handle pre dependencies for installed packages]:How:(($deplist_descriptions))"
        "--dl-installed-deps-runtime[How to handle runtime dependencies for installed packages]:How:(($deplist_descriptions))"
        "--dl-installed-deps-post[How to handle post dependencies for installed packages]:How:(($deplist_descriptions))"
        "--dl-uninstalled-deps-pre[How to handle pre dependencies for uninstalled packages]:How:(($deplist_descriptions))"
        "--dl-uninstalled-deps-post[How to handle post dependencies for uninstalled packages]:How:(($deplist_descriptions))"
        "--dl-uninstalled-deps-runtime[How to handle runtime dependencies for uninstalled packages]:How:(($deplist_descriptions))"
        "--dl-uninstalled-deps-suggested[How to handle suggested dependencies for uninstalled packages]:How:(($deplist_descriptions))"
        "--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|config)|-[[:alpha:]]#u[[:alpha:]]#)] )) ; then
        _arguments -s \
            $general_args[@] $deplist_args[@] $install_uninstall_args[@] $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
    else
        _arguments -s \
            $general_args[@] $deplist_args[@] $list_args[@] $lists[@] $install_uninstall_args[@] $uninstall_args[@] $owner_args[@] $query_args[@] "$action_args[@]" \
            "*:available packages:_paludis_packages available" && return 0
    fi
}

_paludis "$@"