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

complete -C "$1" -F comp/getopts
complete -C "$1" -O --help

function comp/getopts {
	shift
	while [ $# -gt 0 ]; do
		case "$1" in
			--)  shift; break;;
			-?*) shift; continue;;
			*)          break;;
		esac
	done
	if [ $# -eq 2 ]; then
		complete -v
	fi
}
