aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/longboat/config.rb20
-rwxr-xr-xlongboat1
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
diff --git a/longboat b/longboat
index 2edcec8..5275431 100755
--- a/longboat
+++ b/longboat
@@ -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