about summary refs log tree commit diff
path: root/_xtools
blob: 8284ed09465105a0d477cd821addef6f500122ca (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
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
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
#compdef xbuildbarf xbulk xbump xchangelog xcheckrestart xdbg xdiff xdowngrade xgensum xgrep xi xilog xlg xlocate xlog xls xmypkgs xoptdiff xpkg xpkgdiff xq xrecent xrevbump xrevshlib xsrc xsubpkg xtree

_xbps  # force autoload

_xtools_archs=( {aarch64,armv{6,7}l,i686,x86_64}{,-musl} )

_xtools_all_packages() {
	compadd "$@" -- $(xdistdir)/srcpkgs/*(:t)
}

_xtools_one_arch() {
	_arguments : \
		":architecture:($_xtools_archs)"
}

_xtools_one_template() {
	_arguments : \
		':available templates:_xtools_all_packages'
}

_xtools_just_packages() {
	_arguments : \
		'*:package:_xbps_all_packages'
}

_xtools_contributors() {
	compadd "$@" -- $(git -C "$(xdistdir)" log --pretty=%ce)
}

_xbulk() {
	_arguments : \
		'-n[dry-run]' \
		'-k[keep going when a build fails]' \
		'*:available templates:_xtools_all_packages'
}

_xcheckrestart() {
	_arguments : \
		'-v[verbose]'
}

_xdiff() {
	_arguments : \
		'-u[only display differences]' \
		'-l[only list files with differences]' \
		':directory:_files -/'
}

_xdowngrade() {
	_arguments : \
		'*:package files:_files -g \*.xbps'
}

_xgensum() {
	_arguments -s : \
		'-f[force downloading of files]' \
		'-c[use content checksum]' \
		'-i[substitute in-place]' \
		'-H[Absolute path to hostdir]:hostdir:_files -/' \
		':available templates:_xtools_all_packages'
}

_xgrep() {
	_arguments : \
		'1:pattern: ' \
		'*:package:_xbps_installed_packages'
}

_xilog() {
	_arguments : \
		'1::pattern: '
}

_xlocate() {
	_arguments : \
		'-S[sync with official xlocate.git]' \
		'-g[update xlocate.git]' \
		'1::pattern: '
}

_xmypkgs() {
	_arguments : \
		'1::contributor:_xtools_contributors'
}

_xoptdiff() {
	_arguments : \
		'-q[only list differing packages]' \
		'*:package:_xbps_installed_packages'
}

_xpkg() {
	_arguments : \
		'-R[consider only packages from repository]:repository:_files -/' \
		'-a[list all packages]' \
		'-m[list manual packages]' \
		'-O[list orphaned packages]' \
		'-H[list packages on hold]' \
		'-v[show version numbers]' \
		'-V[show version numbers and description]'
}

_xpkgdiff() {
	_arguments : \
		'-S[compare package metadata]' \
		'-c[compare a file from package]:file name:_files:package:_xbps_all_packages' \
		'-f[compare package file lists]' \
		'-p[compare package properties]:property:($_xbps_properties)' \
		'-r[reverse diff (compare local to remote)]' \
		'-x[compare package dependencies]' \
		'-t[compare the full package dependency tree for -x]' \
		'-a[architecture]:architecture:('"$_xtools_archs"')' \
		'*:package:_xtools_just_packages'
}

_xq() {
	_arguments : \
		'-R[include remote information too]' \
		'*:package:_xbps_all_packages'
}

_xrevbump() {
	_arguments : \
		'1:message: ' \
		'*:available templates:_xtools_all_packages'
}

_xsubpkg() {
	_arguments : \
		'-m[list master package]'\
		'*:package:_xbps_all_packages'
}

_xtools() {
	case "$service" in
		xbuildbarf) _xtools_one_arch "$@";;
		xbulk) _xbulk "$@";;
		xbump) _xtools_one_template "$@";;
		xchangelog) _xtools_one_template "$@";;
		xcheckrestart) _xcheckrestart "$@";;
		xdbg) _xtools_just_packages "$@";;
		xdiff) _xdiff "$@";;
		xdowngrade) _xdowngrade "$@";;
		xgensum) _xgensum "$@";;
		xgrep) _xgrep "$@";;
		xi) _xbps_install "$@";;
		xilog) _xilog"$@";;
		xlg) _xtools_one_template "$@";;
		xlocate) _xlocate "$@";;
		xlog) _xtools_one_template "$@";;
		xls) _xtools_just_packages "$@";;
		xmypkgs) _xmypkgs "$@";;
		xoptdiff) _xoptdiff "$@";;
		xpkg) _xpkg "$@";;
		xpkgdiff) _xpkgdiff "$@";;
		xq) _xq "$@";;
		xrecent) _xtools_one_arch "$@";;
		xrevbump) _xrevbump "$@";;
		xrevshlib) _xtools_one_template "$@";;
		xsrc) _xtools_one_template "$@";;
		xsubpkg) _xsubpkg "$@";;
		xtree) _xtools_just_packages "$@";;
	esac
}

_xtools "$@"