about summary refs log tree commit diff
path: root/Completion/Debian/_dpkg
blob: aa80e6fbca8e818d45be81c29b4861631f4a542b (plain) (blame)
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
#compdef dpkg dpkg-deb

local _dpkg_deb_actions _dpkg_common_actions _dpkg_actions _dpkg_options
local curcontext="$curcontext" state line expl ret
typeset -A opt_args

_dpkg_deb_actions=('(--build)-b[build archive]:directory:_files -/' \
           '(-b)--build:directory:_files -/' \
           '(--contents)-c[list contents]:Debian package:_files -g \*.deb' \
           '(-c)--contents:Debian package:_files -g \*.deb' \
           '(--info)-I[show info]:Debian package:_files -g \*.deb' \
           '(-I)--info:Debian package:_files -g \*.deb' \
           '(--field)-f[show fields]:Debian package:_files -g \*.deb' \
           '(-f)--field:Debian package:_files -g \*.deb' \
           '(--control)-e[extract control]:Debian package:_files -g \*.deb' \
           '(-e)--control:Debian package:_files -g \*.deb' \
           '(--extract)-x[extract files]:Debian package:_files -g \*.deb' \
           '(-x)--extract:Debian package:_files -g \*.deb' \
           '(--vextract)-X[extract and list files]:Debian package:_files -g \*.deb' \
           '(-X)--vextract[extract and list]:Debian package:_files -g \*.deb' \
           '--fsys-tarfile[output fs tarfile]:Debian package:_files -g \*.deb')

_dpkg_common_actions=('--help[show help]' \
           '--version[show version]' \
           '(--license)--licence[show licencing]' \
           '(--licence)--license[show licensing]')

_dpkg_actions=('(--install)-i[install packages]:*:Debian packages:->install' \
           '(-i)--install:*:Debian packages:->install' \
           '--unpack[unpack package]:Debian package:_files -g \*.deb' \
           '--configure:package:_deb_packages installed' \
           '(--remove)-r[remove package]:*:package:->remove' \
           '(-r)--remove:*:package:->remove' \
           '(--purge)-P[purge package]:*:package:->purge' \
           '(-P)--purge:*:package:->purge' \
           '(--print-avail)-p[display available details]:packages:_deb_packages avail' \
           '(-p)--print-avail:packages:_deb_packages avail' \
           '--update-avail[update available]:package file:_files' \
           '--merge-avail[merge available]:package file:_files' \
           '(--record-avail)-A[record available]:package file:_files' \
           '(-A)--record-avail:package file:_files' \
           '--forget-old-unavail[forget uninstalled unavailable]' \
           '--clear-avail[clear available]' \
           '(--list)-l[list packages]:*:packages:->list' \
           '(-l)--list:*:packages:->list' \
           '(--status)-s[display package status]:*:packages:->status' \
           '(-s)--status:*:packages:->status' \
           '(--audit)-C[check for broken pkgs]' \
           '(-C)--audit' \
           '--get-selections[get selections]:pattern:' \
           '--set-selections[set selections]' \
	   '--yet-to-unpack[list uninstalled]' \
           '(--listfiles)-L[list owned files]:*:packages:->listfiles' \
           '(-L)--listfiles:*:packages:->listfiles' \
           '(--search)-S[search for file owner]:*:pattern:->search' \
           '(-S)--search:*:pattern:->search' \
           '--print-architecture[print target architecture]' \
           '--print-gnu-build-architecture[print GNU version of target architecture]' \
           '--print-installation-architecture[print host architecture]' \
           '--compare-versions[compare version numbers]:expression:')

_dpkg_options=('--abort-after[abort after errors]:number of errors:' \
           '--admindir=[data directory]:directory:_files -/' \
           '--root=[alternative root]:root:_files -/' \
           '--instdir=[change inst root but not data dir]:_files -/' \
           '(--selected-only)-O[skip unselected packages]' \
           '(-O)--selected-only' \
           '(--skip-same-version)-E[skip packages with same version as installed]' \
           '(-E)--skip-same-version' \
           '(--refuse-downgrade)-G[skip packages with earlier version than installed]' \
           '(-G)--refuse-downgrade' \
           '(--auto-deconfigure)-B[install can break other packages]' \
           '(-B)--auto-deconfigure' \
           '--largemem[optimize for >4Mb RAM]' \
           '--smallmem[optimize for <4Mb RAM]' \
           '--no-act[show potential actions but do not follow through]' \
           '-D+[debug options]:debug options:(h 1 2 3)' \
           '--debug=[debug options]:debug options:(help 1 2 3)' \
           '--ignore-depends=[ignore depends involving package]:package:_deb_packages avail' \
           --{force,refuse,no-force}'--[forcing options]:what:(auto-select downgrade configure-any hold bad-path not-root overwrite overwrite-diverted depends-version depends confnew confold confdef confmiss conflicts architecture overwrite-dir remove-reinstreq remove-essential)')

case "${words[1]:t}" in
dpkg)
_arguments -C -s "$_dpkg_actions[@]" \
           "$_dpkg_deb_actions[@]" \
           "$_dpkg_common_actions[@]" \
           "$_dpkg_options[@]"
;;

dpkg-deb)
_arguments "$_dpkg_deb_actions[@]" \
           "$_dpkg_common_actions[@]"

;;

esac

case "$state" in
  install)
        _funcall ret _dpkg_$state && return ret
        _arguments -C -s "$_dpkg_options[@]" \
	   '*:Debian package:_files -g \*.deb'
;;
  remove|purge|status|listfiles)
        _funcall ret _dpkg_$state && return ret
  	_arguments -C -s "$_dpkg_options[@]" \
	   '*:package:_deb_packages installed'
;;
  list)
        _funcall ret _dpkg_$state && return ret
        _arguments -C -s "$_dpkg_options[@]" \
           '*:packages:_deb_packages avail' \
;;
esac