Class: Sshez::Exec

Inherits:
Object
  • Object
show all
Extended by:
Forwardable
Defined in:
lib/sshez/exec.rb

Overview

handles all the ssh commands and updates to the .ssh/config file

Constant Summary collapse

FILE_PATH =
File.expand_path('~') + '/.ssh/config'
PRINTER =
PrintingManager.instance

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(listener) ⇒ Exec

Must have the methods mentioned above



25
26
27
# File 'lib/sshez/exec.rb', line 25

def initialize(listener)
  @listener = listener
end

Instance Attribute Details

#listenerObject (readonly)

to create an instance pass any Struct(listener) that handles the following methods

  • :argument_error(Command)

  • :done_with_no_guarantee

  • :permission_error

  • :finished_successfully



17
18
19
# File 'lib/sshez/exec.rb', line 17

def listener
  @listener
end

Instance Method Details

#start_exec(command, options) ⇒ Object

Starts the execution of the Command parsed with its options



32
33
34
35
36
# File 'lib/sshez/exec.rb', line 32

def start_exec(command, options)
  all_args = command.args
  all_args << options
  self.send(command.name, *all_args)
end