Class: LogView::Command

Inherits:
Object
  • Object
show all
Includes:
Colors
Defined in:
lib/log_view/command.rb

Constant Summary

Constants included from Colors

LogView::Colors::COLOR_CODES

Instance Method Summary collapse

Methods included from Colors

#paint

Constructor Details

#initialize(config, argv = nil) ⇒ Command



5
6
7
8
# File 'lib/log_view/command.rb', line 5

def initialize config, argv = nil
  @config = config
  @array = argv.compact.map(&:strip).reject {|s| s.empty?}
end

Instance Method Details

#boot!Object



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/log_view/command.rb', line 10

def boot!
  if @array.nil? or @array.empty? or @array.include?("-h") or @array.include?("--help")
    puts help
    return
  end

  project_name = @array.first
  project_config = @config.load_project(project_name)
  project_opts = OptParser.new.parse @array, project_config

  do_ssh = DoTail.new(project_name, project_opts)

  trap("SIGINT") {
    print "\nClosing... "
    do_ssh.close
    print "that's all folks!\n"
    exit!
  }

  do_ssh.start
end