Module: Eclair::Console

Extended by:
Console
Includes:
CommonHelper
Included in:
Console
Defined in:
lib/eclair/console.rb

Instance Method Summary collapse

Methods included from CommonHelper

#config, included

Instance Method Details

#initObject



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
# File 'lib/eclair/console.rb', line 6

def init
  config
  ENV['ESCDELAY'] = "0"
  init_screen
  stdscr.keypad = true
  start_color
  use_default_colors
  crmode
  noecho
  curs_set(0)
  Grid.start
  trap("INT") { exit }
  loop do
    case k = stdscr.getch
    when KEY_RESIZE
      Grid.resize
    when KEY_LEFT, KEY_RIGHT, KEY_UP, KEY_DOWN
      Grid.move k
    when " "
      if Grid.mode == :search
        Grid.end_search
      end
      Grid.select
    when 10
      case Grid.mode
      when :search
        Grid.end_search
      else
        Grid.ssh
      end
    when 27
      if Grid.mode == :search
        Grid.cancel_search
      end
    when ?!
      Grid.debug
    when ??
      Grid.cursor_inspect
    when KEY_BACKSPACE, 127
      Grid.search(nil)
    when String
      Grid.search(k)
    else
      # Aws.reload_instances
      # Grid.render_all
    end
  end
end