portspec_crack() filters the input and returns nil if the input is bad, but doesn't exactly function like a validate(), and there needs to be a way to warn the user the input is bad. Some aux modules using portspec_crack() do this by checking nil and does a print_error, but not always (code review was bad back then). Also instead of ArgumentError or print_error, the correct exception to throw is Msf::OptionValidateError.new because that's what option validators throw.

The best implementation would be adding a real OptPorts. I bet this has been discussed before but I don't know why we haven't done it. @todb-r7 you know any history about that?