bash-completion/bash-completion-mock
Ville Skyttä c2f930c698 - Trigger-install support for gcl, lilypond, mercurial and svk.
- Improve mock completion a bit.
2006-08-30 21:27:32 +00:00

45 lines
1.2 KiB
Bash

# bash completion for mock -*- sh -*-
_mock()
{
local cur prev commands cfgdir
COMPREPLY=()
cur=${COMP_WORDS[COMP_CWORD]}
prev=${COMP_WORDS[COMP_CWORD-1]}
commands='rebuild chroot init clean shell'
cfgdir=/etc/mock
count=0
for i in ${COMP_WORDS[@]} ; do
[ $count -eq $COMP_CWORD ] && break
[ "$i" == --configdir ] && cfgdir="${COMP_WORDS[((count+1))]}"
count=$((++count))
done
case $prev in
--@(config|result|state)dir)
_filedir -d
return 0
;;
-r)
COMPREPLY=( $( command ls $cfgdir | \
sed -ne 's/^\('$cur'.*\)\.cfg$/\1/p') )
return 0
;;
-@(-arch|-uniqueext|-help|h))
return 0
;;
esac
# TODO: process $commands
if [[ "$cur" == -* ]] ; then
COMPREPLY=( $( compgen -W '--version -h --help -r --no-clean --arch \
--debug --resultdir --statedir --uniqueext --configdir --quiet \
--autocache --rebuildcache' -- $cur ) )
else
_filedir '?(no)src.rpm'
fi
}
complete -F _mock $filenames mock