summary refs log tree commit diff
path: root/_xtools
blob: 34f7d8283434377406f6c45ad17b6eec11e990f5 (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
#compdef xbulk xbump xdiff xgensum xgrep xlg xlog xls xmindep xnew xnuxnu xoptdiff xq xsrc

_xbps  # force autoload

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

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

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

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

_xgensum() {
	_arguments : \
		'-i[substitute in-place]' \
		':available templates:_xtools_all_packages'
}

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

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

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

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

_xtools() {
	case "$service" in
		xbulk) _xbulk "$@";;
		xbump) _xtools_one_template "$@";;
		xdiff) _xdiff "$@";;
		xgensum) _xgensum "$@";;
		xgrep) _xgrep "$@";;
		xlg) _xtools_one_template "$@";;
		xlog) _xtools_one_template "$@";;
		xls) _xtools_just_packages "$@";;
		xmindep) _xtools_just_packages "$@";;
		xnuxnu) _xtools_one_template "$@";;
		xoptdiff) _xoptdiff "$@";;
		xq) _xq "$@";;
		xsrc) _xtool_one_template "$@";;
		xsubpkg) _xtool_one_template "$@";;
	esac
}

_xtools "$@"