Subversion Repositories configs

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
136 - 1
# -*- mode: shell-script; sh-basic-offset: 8; indent-tabs-mode: t -*-
2
# ex: ts=8 sw=8 noet filetype=sh
3
#
4
# bash completion for rpmdevtools
5
# Requires bash-completion >= 20080705 (for _get_cword)
6
 
7
# TODO: rpmdev-diff, rpmdev-vercmp
8
 
9
_rpmdev_rpmfiles()
10
{
11
	local cur=${cur:-`_get_cword`}
12
	_filedir '[rs]pm'
13
}
14
 
15
_rpmdev_archives()
16
{
17
	local cur=${cur:-`_get_cword`}
18
	_filedir '@([rs]pm|deb|zip|?([ejtw])ar|tzo|[glx7]z|bz2|lzma|cpio|arj|zoo|cab|rar|ace|lha)'
19
}
20
 
21
_rpmdev_specfiles()
22
{
23
	local cur=${cur:-`_get_cword`}
24
	_filedir spec
25
}
26
 
27
complete -F _rpmdev_rpmfiles -o filenames rpmdev-checksig
28
 
29
complete -F _rpmdev_archives -o filenames \
30
	rpmdev-{cksum,md5,sha{1,224,256,384,512},sum}
31
 
32
_spectool()
33
{
34
	COMPREPLY=()
35
 
36
	for i in ${COMP_WORDS[@]} ; do
37
		[[ "$i" == -@(h|-help) ]] && return 0
38
	done
39
 
40
	local cur=`_get_cword`
41
	case $3 in
42
		-@(C|-directory))
43
			_filedir -d
44
			return 0
45
			;;
46
		-@(s|-source|p|-patch|d|-define))
47
			# TODO: do better with these
48
			return 0
49
			;;
50
	esac
51
 
52
	if [[ "$cur" == -* ]] ; then
53
		COMPREPLY=( $( compgen -W '-l --lf --list-files -g --gf \
54
			--get-files -h --help -A --all -S --sources -P \
55
			--patches -s --source -p --patch -d --define -C \
56
			--directory -R --sourcedir -n --dryrun --dry-run \
57
			-D --debug' -- $cur ) )
58
	else
59
		_rpmdev_specfiles
60
	fi
61
}
62
complete -F _spectool -o filenames spectool
63
 
64
_rpmdev_bumpspec()
65
{
66
	COMPREPLY=()
67
 
68
	for i in ${COMP_WORDS[@]} ; do
69
		[[ "$i" == -@(h|-help|v|-version) ]] && return 0
70
	done
71
 
72
	[[ $3 == -@(c|-comment|u|-userstring) ]] && return 0
73
 
74
	local cur=`_get_cword`
75
	if [[ "$cur" == -* ]] ; then
76
		COMPREPLY=( $( compgen -W '-h --help -c --comment -u \
77
			--userstring -r --rightmost -V --verbose -v \
78
			--version' -- $cur ) )
79
	else
80
		_rpmdev_specfiles
81
	fi
82
}
83
complete -F _rpmdev_bumpspec -o filenames rpmdev-bumpspec
84
 
85
_rpmdev_rmdevelrpms()
86
{
87
	COMPREPLY=()
88
 
89
	for i in ${COMP_WORDS[@]} ; do
90
		[[ "$i" == -@(h|-help|v|-version) ]] && return 0
91
	done
92
 
93
	[[ $3 == --@(qf|queryformat) ]] && return 0
94
 
95
	COMPREPLY=( $( compgen -W '-h --help -l --list-only -y --yes \
96
			-v --version --qf --queryformat' -- `_get_cword` ) )
97
}
98
complete -F _rpmdev_rmdevelrpms rpmdev-rmdevelrpms
99
 
100
_rpmdev_setuptree()
101
{
102
	local cur=`_get_cword`
103
	if [[ "$cur" == -* ]] ; then
104
		COMPREPLY=( $( compgen -W '-d' -- $cur ) )
105
	fi
106
}
107
complete -F _rpmdev_setuptree rpmdev-setuptree
108
 
109
_rpmls()
110
{
111
	COMPREPLY=()
112
	local cur=`_get_cword`
113
 
114
	if [[ "$cur" == -* ]] ; then
115
		COMPREPLY=( $( compgen -W '-l' -- $cur ) )
116
		return 0
117
	fi
118
 
119
	[[ "$cur" == */* ]] || _rpm_installed_packages
120
	_rpmdev_rpmfiles
121
}
122
complete -F _rpmls -o filenames rpmls
123
 
124
_rpmdev_newspec()
125
{
126
	COMPREPLY=()
127
 
128
	for i in ${COMP_WORDS[@]} ; do
129
		[[ "$i" == -@(h|-help|v|-version) ]] && return 0
130
	done
131
 
132
	local cur=`_get_cword`
133
	case $3 in
134
		-o|--output)
135
			_filedir spec
136
			return 0
137
			;;
138
		-t|--type)
139
			COMPREPLY=( $( command ls /etc/rpmdevtools/spectemplate-*.spec 2>/dev/null ) )
140
			COMPREPLY=( ${COMPREPLY[@]%.spec} )
141
			COMPREPLY=( ${COMPREPLY[@]#/etc/rpmdevtools/spectemplate-} )
142
			COMPREPLY=( $( compgen -W '${COMPREPLY[@]}' -- $cur ) )
143
			return 0
144
			;;
145
	esac
146
 
147
	if [[ "$cur" == -* ]] ; then
148
		COMPREPLY=( $( compgen -W '-t --type -o --output -m --macros \
149
			-h --help -v --version' -- $cur ) )
150
		return 0
151
	fi
152
 
153
	_filedir spec
154
}
155
complete -F _rpmdev_newspec -o filenames rpmdev-newspec
156
 
157
_rpminfo()
158
{
159
	COMPREPLY=()
160
 
161
	for i in ${COMP_WORDS[@]} ; do
162
		[[ "$i" == -@(h|-help) ]] && return 0
163
	done
164
 
165
	local cur=`_get_cword`
166
	case $3 in
167
		-o|--output)
168
			_filedir
169
			return 0
170
			;;
171
		-T|--tmp-dir)
172
			_filedir -d
173
			return 0
174
			;;
175
	esac
176
 
177
	if [[ "$cur" == -* ]] ; then
178
		COMPREPLY=( $( compgen -W '-h --help -v --verbose -q --quiet
179
			-qq -i --installed -e --executables -l --libraries -p
180
			--pic -np --no_pic -P --pie -nP --no_pie -r --rpath -ro
181
			--rpath_odd -s --split -t --test -o --output -T
182
			--tmp-dir' -- $cur ) )
183
		return 0
184
	fi
185
 
186
	[[ "$cur" == */* ]] || _rpm_installed_packages
187
	_rpmdev_rpmfiles
188
}
189
complete -F _rpminfo -o filenames rpminfo
190
 
191
_rpmdev_extract()
192
{
193
	COMPREPLY=()
194
 
195
	for i in ${COMP_WORDS[@]} ; do
196
		[[ "$i" == -@(h|v) ]] && return 0
197
	done
198
 
199
	local cur=`_get_cword`
200
	if [[ $3 == -C ]] ; then
201
		_filedir -d
202
		return 0
203
	fi
204
 
205
	if [[ "$cur" == -* ]] ; then
206
		COMPREPLY=( $( compgen -W '-q -f -C -h -v' -- $cur ) )
207
		return 0
208
	fi
209
 
210
	_rpmdev_archives
211
}
212
complete -F _rpmdev_extract -o filenames rpmdev-extract