# completion settings for the trap built-in
# written by magicant
# vim: set ft=sh ts=8 sts=8 sw=8 noet:

complete -C "$1" -X -F comp/trap

complete -C "$1" -O p -O --print \
	-D "print current trap settings"
complete -C "$1" -O --help

function comp/trap {
	# skip options
	shift
	while [ $# -gt 1 ]; do
		case "$1" in
			--)  shift; break;;
			-?*) shift;;
			*)   break;;
		esac
	done

	if [ $# -le 1 ]; then
		# complete a command name
		complete -c
	else
		# complete a signal name
		complete --signal
	fi
}
