Custom getopts function functioningy correctly