Merge pull request #128 from dpeters/option_parsing

Catch basic option parser exceptions
This commit is contained in:
Jordan Sissel 2011-12-03 22:19:15 -08:00
commit 2334c3a878
1 changed files with 7 additions and 1 deletions

View File

@ -104,7 +104,13 @@ class FPM::Program
fpmrc(opts)
# Proces normal flags now.
remaining = opts.parse(args)
begin
remaining = opts.parse(args)
rescue OptionParser::MissingArgument, OptionParser::InvalidOption
$stderr.puts $!.to_s
$stderr.puts opts
exit 2
end
# need to print help in a different scope
@help = opts.help