H
Hacksaw
This code snippet processes the options correctly, but if I leave off a
required argument, it fails run my rescue block.
Why is that?
begin
opts = GetoptLong.new(
[ "--in", "-f", GetoptLong::REQUIRED_ARGUMENT ],
[ "--out", "-o", GetoptLong::REQUIRED_ARGUMENT ],
[ "--version", GetoptLong::NO_ARGUMENT ],
[ "--help", "-h", "-?", GetoptLong::NO_ARGUMENT ]
)
rescue GetoptLong::MissingArgument
$stderr.print "Missing Argument"
raise
end
required argument, it fails run my rescue block.
Why is that?
begin
opts = GetoptLong.new(
[ "--in", "-f", GetoptLong::REQUIRED_ARGUMENT ],
[ "--out", "-o", GetoptLong::REQUIRED_ARGUMENT ],
[ "--version", GetoptLong::NO_ARGUMENT ],
[ "--help", "-h", "-?", GetoptLong::NO_ARGUMENT ]
)
rescue GetoptLong::MissingArgument
$stderr.print "Missing Argument"
raise
end