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
|
|
|
|
|
|
|
|
have mock &&
|
|
|
|
_mock()
|
|
|
|
{
|
2009-10-04 19:42:50 +02:00
|
|
|
local cur prev plugins cfgdir split=false
|
2009-05-31 23:52:47 +03:00
|
|
|
|
2009-10-04 19:42:50 +02:00
|
|
|
COMPREPLY=()
|
2010-02-08 17:25:08 +01:00
|
|
|
_get_comp_words_by_ref cur prev
|
2009-10-04 19:42:50 +02:00
|
|
|
plugins='tmpfs root_cache yum_cache bind_mount ccache'
|
|
|
|
cfgdir=/etc/mock
|
2009-05-31 23:52:47 +03:00
|
|
|
|
2009-10-04 19:42:50 +02:00
|
|
|
count=0
|
|
|
|
for i in "${COMP_WORDS[@]}" ; do
|
|
|
|
[ $count -eq $COMP_CWORD ] && break
|
|
|
|
if [[ "$i" == --configdir ]] ; then
|
|
|
|
cfgdir="${COMP_WORDS[((count+1))]}"
|
|
|
|
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
|
|
|
_split_longopt && split=true
|
2009-05-31 23:52:47 +03:00
|
|
|
|
2009-10-04 19:42:50 +02:00
|
|
|
case $prev in
|
2009-11-22 11:43:26 +01: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
|
2009-10-18 22:12:37 +03:00
|
|
|
COMPREPLY=( $( compgen -W '--version --help --rebuild \
|
2009-10-04 19:42:50 +02:00
|
|
|
--buildsrpm --shell --chroot --clean --init \
|
|
|
|
--installdeps --install --update --orphanskill \
|
2009-10-18 22:12:37 +03:00
|
|
|
--copyin --copyout --root --offline --no-clean \
|
2009-10-04 19:42:50 +02:00
|
|
|
--cleanup-after --no-cleanup-after --arch --target \
|
2009-10-18 22:12:37 +03:00
|
|
|
--define --with --without --resultdir --uniqueext \
|
2009-10-04 19:42:50 +02:00
|
|
|
--configdir --rpmbuild_timeout --unpriv --cwd --spec \
|
2009-10-18 22:12:37 +03:00
|
|
|
--sources --verbose --quiet --trace --enable-plugin \
|
|
|
|
--disable-plugin --print-root-path' -- "$cur" ) )
|
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
|
|
|
} &&
|
2009-10-22 12:04:29 +03:00
|
|
|
complete -F _mock -o filenames 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
|