Class: Pair::CommandLine

Inherits:
Object
  • Object
show all
Defined in:
lib/pair/command_line.rb,
lib/pair/command_line/host.rb

Direct Known Subclasses

Host

Defined Under Namespace

Classes: Host

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(arguments) ⇒ CommandLine

Returns a new instance of CommandLine.



13
14
15
16
# File 'lib/pair/command_line.rb', line 13

def initialize(arguments)
  self.arguments = arguments
  self.options   = {}
end

Instance Attribute Details

#argumentsObject

Returns the value of attribute arguments.



6
7
8
# File 'lib/pair/command_line.rb', line 6

def arguments
  @arguments
end

#optionsObject

Returns the value of attribute options.



6
7
8
# File 'lib/pair/command_line.rb', line 6

def options
  @options
end

Class Method Details

.run!(*arguments) ⇒ Object



9
10
11
# File 'lib/pair/command_line.rb', line 9

def self.run!(*arguments)
  new(*arguments).run!
end

Instance Method Details

#run!Object



18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/pair/command_line.rb', line 18

def run!
  case command = arguments.shift
  when 'host'
    require "pair/command_line/host"
    Host.run!(arguments)
  else
    unknown_command(command)
  end
rescue SystemExit
  raise
rescue
  if $-d
    STDOUT.puts "\n"
    STDOUT.puts "  Please contact [email protected], there"
    STDOUT.puts "  was an issue creating your session."
    STDOUT.puts "\n"
  else
    raise
  end
end