# moosic(2) completion
# 
# Copyright 2003 "Etienne PIERRE" <etienne@tuxfamily.org>
#
have moosic &&
_moosic()
{
	local cur options paroptions

	COMPREPLY=()
	cur=${COMP_WORDS[COMP_CWORD]}
	prev=${COMP_WORDS[COMP_CWORD-1]}
	
	options='-d --shuffle-dir -a --shuffle-args \
		-g --shuffle-global -o --inorder -n --no-file-munge \
		-S --showcommands -h --help -v --version'
	commands='append add pl-append pl-add prepend pl-prepend mixin \
		pl-mixin putback insert pl-insert cut crop remove filter \
		clear wipe move reshuffle shuffle sort reverse partial-sort \
		stagger current curr list plainlist history hist state \
		version next noplay stop sleep pause unpause toggle-pause \
		play wake reconfigure reconfig showconfig exit quit die'
	
	paroptions="$options $commands"
	
	if [ ${COMP_CWORD} -eq 1 ]; then
	    COMPREPLY=($( compgen -W "$paroptions" | grep ^$cur ))
	else
	    case "$prev" in
		-*)
		    COMPREPLY=($( compgen -W "$paroptions" | grep ^$cur ))
		;;
		*)
		    _filedir
		;;
	    esac
	fi

	return 0

}
[ "$have" ] && complete -F _moosic -o filenames moosic



