blob: 6c882896a8383e14f08348b3b920b0a6ec693373 (
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
|
# bash completion for rpmbuildupdate
# $Id$
_rpmbuildupdate()
{
local cur prev rpmpath file
COMPREPLY=()
cur=${COMP_WORDS[COMP_CWORD]}
prev=${COMP_WORDS[COMP_CWORD-1]}
case $prev in
--rpmmon)
_filedir
return 0
;;
--@(srpms|top))
_filedir -d
return 0
;;
esac
if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W '--rpmmon --srpms --rpmoption \
--release --changelog --deps --log --nosource \
--noupdate --top --nobuild --execute -c --execafterbuild' -- $cur ) )
else
# get source rpm path
for file in /etc/rpmbuildupdate $HOME/.rpmbuildupdaterc; do
if [ -f $file ]; then
rpmpath=`awk -F" *= *" '/srpms/ {print $2}' $file`
fi
done
for (( i=1; i < COMP_CWORD; i++ )); do
if [[ "${COMP_WORDS[i]}" == --srpms ]]; then
rpmpath=${COMP_WORDS[i+1]}
break
fi
done
if [ -n "$rpmpath" ]; then
rpmpath=${rpmpath//,/ }
COMPREPLY=( $( eval command ls "$rpmpath" 2>/dev/null | \
sed -ne 's|^\('$cur'.*\)-[0-9a-zA-Z._]\+-[0-9a-z.@]\+\.src\.rpm$|\1|p' ) )
fi
_filedir
fi
}
complete -F _rpmbuildupdate $filenames rpmbuildupdate
|