Class: Forward::Command::Base

Inherits:
Object
  • Object
show all
Includes:
Forward::Common
Defined in:
lib/forward/command/base.rb

Direct Known Subclasses

Account, Config, Tunnel

Constant Summary

Constants included from Forward::Common

Forward::Common::EMAIL_REGEX

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Forward::Common

#config, #exit_with_error, #exit_with_message, #logged_in?, #logger, #os, #stop_reactor_and_exit, #windows?

Constructor Details

#initialize(options = {}, args = []) ⇒ Base

Returns a new instance of Base.



14
15
16
17
18
19
20
# File 'lib/forward/command/base.rb', line 14

def initialize(options = {}, args = [])
  @opts    = options
  @options = options.to_hash
  @args    = args
  logger.debug "[CLI] options: #{@options.inspect}"
  logger.debug "[CLI] args: #{@args.inspect}"
end

Instance Attribute Details

#argsObject

Returns the value of attribute args.



7
8
9
# File 'lib/forward/command/base.rb', line 7

def args
  @args
end

#optionsObject

Returns the value of attribute options.



6
7
8
# File 'lib/forward/command/base.rb', line 6

def options
  @options
end

Class Method Details

.run(command, options = {}, args = []) ⇒ Object



9
10
11
12
# File 'lib/forward/command/base.rb', line 9

def self.run(command, options = {}, args = [])
  Forward.logger.debug "[CLI] running `#{command}'"
  new(options, args).send(command)
end