Class: Evostream::Runner

Inherits:
Object
  • Object
show all
Defined in:
lib/evostream/cli/runner.rb

Overview

Execute CLI with this gem

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeRunner



29
30
31
32
# File 'lib/evostream/cli/runner.rb', line 29

def initialize
  CLI::Config.instance
  @options = CLI::Options.new
end

Instance Attribute Details

#optionsObject (readonly)

Returns the value of attribute options.



27
28
29
# File 'lib/evostream/cli/runner.rb', line 27

def options
  @options
end

Instance Method Details

#run(args = ARGV) ⇒ Object

rubocop:disable Metrics/MethodLength



35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
# File 'lib/evostream/cli/runner.rb', line 35

def run(args = ARGV)
  @options.parse

  access_evostream?
  execute_runner(two_last_arg(args)) if args.count >= 1
rescue CodeError::Evostream::ConnectionFailed
  201
rescue CodeError::Evostream::NoResult
  200
rescue CodeError::Syntax::CommandInvalid
  101
rescue CodeError::Syntax::OptionInvalid
  100
rescue Evostream::Commands::Errors::MissingMandatory => error
  $stdout.puts error.message.red
  50
rescue CodeError::Finished
  0
end