aboutsummaryrefslogtreecommitdiff
path: root/lib/longboat
diff options
context:
space:
mode:
authorNat Lasseter <nat.lasseter@york.ac.uk>2020-11-09 16:40:02 +0000
committerNat Lasseter <nat.lasseter@york.ac.uk>2020-11-09 16:40:02 +0000
commit8e9d8d9e0837104d684547464ba3d0aa8f8e60ea (patch)
tree9036231c4577c59291bc314e039aeb9a9574cab3 /lib/longboat
parenta41dcd0601cb4099daedbbb1fb29af0b756d0778 (diff)
Updated config parsing: catch command line errors thrown by parser
Diffstat (limited to 'lib/longboat')
-rw-r--r--lib/longboat/config.rb20
1 files changed, 17 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