2010-03-20 22:40:00 +02:00
|
|
|
# Use of this file is deprecated. Upstream completion is available in
|
|
|
|
# mock > 1.1.0, use that instead.
|
|
|
|
|
2009-05-31 23:52:47 +03:00
|
|
|
# bash completion for mock
|
|
|
|
|
2011-04-05 00:35:51 +03:00
|
|
|
have mock || return
|
|
|
|
|
2009-05-31 23:52:47 +03:00
|
|
|
_mock()
|
|
|
|
{
|
2011-05-01 22:18:40 +03:00
|
|
|
local cur prev words cword split
|
|
|
|
_init_completion -s || return
|
2009-05-31 23:52:47 +03:00
|
|
|
|
2011-04-20 14:02:21 +03:00
|
|
|
local plugins='tmpfs root_cache yum_cache bind_mount ccache'
|
|
|
|
local cfgdir=/etc/mock count=0 i
|
2009-05-31 23:52:47 +03:00
|
|
|
|
2011-04-20 14:02:21 +03:00
|
|
|
for i in "${words[@]}" ; do
|
|
|
|
[ $count -eq $cword ] && break
|
2009-10-04 19:42:50 +02:00
|
|
|
if [[ "$i" == --configdir ]] ; then
|
2011-04-20 14:02:21 +03:00
|
|
|
cfgdir="${words[((count+1))]}"
|
2009-10-04 19:42:50 +02:00
|
|
|
elif [[ "$i" == --configdir=* ]] ; then
|
|
|
|
cfgdir=${i/*=/}
|
|
|
|
fi
|
|
|
|
count=$((++count))
|
|
|
|
done
|
2009-05-31 23:52:47 +03:00
|
|
|
|
2009-10-04 19:42:50 +02:00
|
|
|
case $prev in
|
2010-10-24 12:37:22 +03:00
|
|
|
-h|--help|--copyin|--copyout|--arch|-D|--define|--with|--without|\
|
|
|
|
--uniqueext|--rpmbuild_timeout|--sources|--cwd)
|
2009-10-04 19:42:50 +02:00
|
|
|
return 0
|
|
|
|
;;
|
|
|
|
-r|--root)
|
|
|
|
COMPREPLY=( $( compgen -W "$( command ls $cfgdir )" -- $cur ) )
|
|
|
|
COMPREPLY=( ${COMPREPLY[@]/%.cfg/} )
|
|
|
|
return 0
|
|
|
|
;;
|
2009-11-22 11:43:26 +01:00
|
|
|
--configdir|--resultdir)
|
2009-10-04 19:42:50 +02:00
|
|
|
_filedir -d
|
|
|
|
return 0
|
|
|
|
;;
|
|
|
|
--spec)
|
|
|
|
_filedir spec
|
|
|
|
return 0
|
|
|
|
;;
|
|
|
|
--target)
|
|
|
|
# Yep, compatible archs, not compatible build archs
|
|
|
|
# (e.g. ix86 chroot builds in x86_64 mock host)
|
|
|
|
# This would actually depend on what the target root
|
|
|
|
# can be used to build for...
|
|
|
|
COMPREPLY=( $( compgen -W "$( command rpm --showrc | \
|
2009-11-03 22:04:46 +02:00
|
|
|
sed -ne 's/^\s*compatible\s\s*archs\s*:\s*\(.*\)/\1/i p' )" \
|
2009-10-04 19:42:50 +02:00
|
|
|
-- "$cur" ) )
|
|
|
|
return 0
|
|
|
|
;;
|
2009-11-22 11:43:26 +01:00
|
|
|
--enable-plugin|--disable-plugin)
|
2009-10-04 19:42:50 +02:00
|
|
|
COMPREPLY=( $( compgen -W "$plugins" -- "$cur" ) )
|
|
|
|
return 0
|
|
|
|
;;
|
|
|
|
esac
|
2009-05-31 23:52:47 +03:00
|
|
|
|
2009-10-04 19:42:50 +02:00
|
|
|
$split && return 0
|
2009-05-31 23:52:47 +03:00
|
|
|
|
2009-10-04 19:42:50 +02:00
|
|
|
if [[ "$cur" == -* ]] ; then
|
2011-04-28 21:21:31 +03:00
|
|
|
COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) )
|
2011-05-02 11:41:52 +03:00
|
|
|
[[ $COMPREPLY == *= ]] && compopt -o nospace
|
2009-10-04 19:42:50 +02:00
|
|
|
else
|
2010-10-07 20:05:55 +03:00
|
|
|
_filedir '@(?(no)src.r|s)pm'
|
2009-10-04 19:42:50 +02:00
|
|
|
fi
|
2009-05-31 23:52:47 +03:00
|
|
|
} &&
|
2010-11-01 19:26:53 +02:00
|
|
|
complete -F _mock mock
|
2009-10-01 20:54:51 +03:00
|
|
|
|
|
|
|
# Local variables:
|
|
|
|
# mode: shell-script
|
2009-10-04 19:42:50 +02:00
|
|
|
# sh-basic-offset: 4
|
2009-10-01 20:54:51 +03:00
|
|
|
# sh-indent-comment: t
|
2009-10-04 19:42:50 +02:00
|
|
|
# indent-tabs-mode: nil
|
2009-10-01 20:54:51 +03:00
|
|
|
# End:
|
2009-10-04 19:42:50 +02:00
|
|
|
# ex: ts=4 sw=4 et filetype=sh
|