2020-06-10 18:25:41 +02:00
|
|
|
extends Node2D
|
|
|
|
|
2020-09-01 15:14:01 +02:00
|
|
|
var thread
|
|
|
|
|
2020-09-01 19:59:07 +02:00
|
|
|
var history = []
|
|
|
|
var history_position = 0
|
|
|
|
|
|
|
|
func _input(event):
|
|
|
|
if history.size() > 0:
|
|
|
|
if event.is_action_pressed("ui_up"):
|
|
|
|
history_position -= 1
|
|
|
|
history_position %= history.size()
|
|
|
|
$Input.text = history[history_position]
|
|
|
|
if event.is_action_pressed("ui_down"):
|
|
|
|
history_position += 1
|
|
|
|
history_position %= history.size()
|
|
|
|
$Input.text = history[history_position]
|
|
|
|
|
2020-09-01 14:03:18 +02:00
|
|
|
func send_command(command):
|
2020-09-01 19:59:07 +02:00
|
|
|
history.push_back(command)
|
|
|
|
history_position += 1
|
|
|
|
|
2020-09-01 15:14:01 +02:00
|
|
|
thread = Thread.new()
|
|
|
|
thread.start(self, "run_command_in_a_thread", command)
|
|
|
|
|
|
|
|
func run_command_in_a_thread(command):
|
2020-09-01 19:20:51 +02:00
|
|
|
var output = game.sh(command, "/tmp/active")
|
2020-09-01 14:03:18 +02:00
|
|
|
|
2020-08-24 16:48:30 +02:00
|
|
|
$Input.text = ""
|
2020-09-01 19:20:51 +02:00
|
|
|
$Output.text = $Output.text + "$ " + command + "\n" + output
|
2020-08-24 16:48:30 +02:00
|
|
|
$Output.scroll_vertical = 999999
|
2020-09-01 19:32:33 +02:00
|
|
|
$"../ActiveRepository".update_everything()
|