Module: Lifelike::CLI
- Defined in:
- lib/lifelike/cli.rb,
lib/lifelike/cli/options.rb
Defined Under Namespace
Classes: Options
Constant Summary collapse
- EX_USAGE =
Conventional exit codes from BSD’s sysexits.h See: www.freebsd.org/cgi/man.cgi?query=sysexits
64
- EX_DATAERR =
Command was used incorrectly
65
Class Method Summary collapse
-
.invoke ⇒ Object
Input data was incorrect.
- .report_error(error) ⇒ Object
Class Method Details
.invoke ⇒ Object
Input data was incorrect
9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/lifelike/cli.rb', line 9 def self.invoke = Options.parse!(ARGV) puts Runner.new(ARGF.read, ).run exit rescue OptionParser::ParseError, UnparsableRuleStringError => e report_error e exit EX_USAGE rescue UnexpectedCharacterError, InsufficientValidCharacterError => e report_error e exit EX_DATAERR end |
.report_error(error) ⇒ Object
21 22 23 |
# File 'lib/lifelike/cli.rb', line 21 def self.report_error(error) $stderr.puts "lifelike: #{error}" end |