Class: Dobby::CLI
- Inherits:
-
Object
- Object
- Dobby::CLI
- Defined in:
- lib/dobby/cli.rb
Overview
The dobby CLI.
Defined Under Namespace
Classes: Finished
Constant Summary collapse
- STATUS_SUCCESS =
0
- STATUS_WARNING =
1
- STATUS_ERROR =
2
Instance Attribute Summary collapse
-
#options ⇒ Object
readonly
Returns the value of attribute options.
Instance Method Summary collapse
-
#initialize ⇒ CLI
constructor
A new instance of CLI.
- #run(args = ARGV) ⇒ Object
Constructor Details
#initialize ⇒ CLI
Returns a new instance of CLI.
14 15 16 |
# File 'lib/dobby/cli.rb', line 14 def initialize @options = {} end |
Instance Attribute Details
#options ⇒ Object (readonly)
Returns the value of attribute options.
12 13 14 |
# File 'lib/dobby/cli.rb', line 12 def @options end |
Instance Method Details
#run(args = ARGV) ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/dobby/cli.rb', line 18 def run(args = ARGV) @options, files = Options.new.parse(args) execute_runner(files) rescue Finished STATUS_SUCCESS rescue OptionParser::InvalidOption => e warn e. warn 'For usage information, use --help' STATUS_ERROR rescue StandardError, SyntaxError, LoadError => e warn e. warn e.backtrace STATUS_ERROR end |