lib/mercenary/program.rb in mercenary-0.3.4 vs lib/mercenary/program.rb in mercenary-0.3.5

- old
+ new

@@ -25,10 +25,17 @@ @optparse = OptionParser.new do |opts| cmd = super(argv, opts, @config) end - @optparse.parse!(argv) + begin + @optparse.parse!(argv) + rescue OptionParser::InvalidOption => e + logger.error "Whoops, we can't understand your command." + logger.error "#{e.message}" + logger.error "Run your command again with the --help switch to see available options." + abort + end logger.debug("Parsed config: #{@config.inspect}") begin cmd.execute(argv, @config)