diff options
-rw-r--r-- | lib/longboat/config.rb | 20 | ||||
-rwxr-xr-x | longboat | 1 |
2 files changed, 18 insertions, 3 deletions
diff --git a/lib/longboat/config.rb b/lib/longboat/config.rb index cd27bf9..dffbc08 100644 --- a/lib/longboat/config.rb +++ b/lib/longboat/config.rb @@ -27,15 +27,29 @@ module Longboat exit rescue Optimist::VersionNeeded exit + rescue Optimist::CommandlineError => e + puts "Command line error:" + puts e.message + puts + puts "Try --help, or refer to raider documentation." + exit 1 end end def self.for_raider(&block) parser = Optimist::Parser.new(&block) parser.ignore_invalid_options = true - opts = parser.parse - opts.delete(:help) - opts + begin + opts = parser.parse + opts.delete(:help) + opts + rescue Optimist::CommandlineError => e + puts "Command line error:" + puts e.message + puts + puts "Try --help, or refer to raider documentation." + exit 1 + end end end end @@ -13,6 +13,7 @@ raiders = Longboat::Raiders.new(collector, config) unless ARGV.empty? puts "Extraneous or unrecognised arguments:" puts " " + ARGV.join(" ") + puts puts "Try --help, or refer to raider documentation." exit 1 end |