-
Notifications
You must be signed in to change notification settings - Fork 610
/
driver_console.rb
45 lines (37 loc) · 920 Bytes
/
driver_console.rb
1
2
3
4
5
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
##
# driver_console.rb
# Created August 29, 2015
# By Ron Bowes
#
# See: LICENSE.md
#
##
class DriverConsole
attr_reader :stopped
def initialize(window, settings)
@window = window
@settings = settings
@outgoing = ""
@window.on_input() do |data|
@outgoing += data
@outgoing += "\n"
end
@window.puts("This is a console session!")
@window.puts()
@window.puts("That means that anything you type will be sent as-is to the")
@window.puts("client, and anything they type will be displayed as-is on the")
@window.puts("screen! If the client is executing a command and you don't")
@window.puts("see a prompt, try typing 'pwd' or something!")
@window.puts()
@window.puts("To go back, type ctrl-z.")
@window.puts()
end
def feed(data)
@window.print(data)
out = @outgoing
@outgoing = ''
return out
end
def shutdown()
end
end