Files

26 lines
673 B
GDScript

@tool
extends SelectableContainer
signal command_requested(command: String)
@onready var output: RichTextLabel = $Output
@onready var command_input: LineEdit = $Command
func _ready() -> void:
super._ready()
if Engine.is_editor_hint():
return
command_input.text_submitted.connect(_submit)
func _submit(command: String) -> void:
if command.strip_edges().is_empty():
return
append_output("$ " + command + "\n")
command_input.clear()
if command_requested.get_connections().is_empty():
append_output("No SSH transport connected. Command was not sent.\n")
else:
command_requested.emit(command)
func append_output(text: String) -> void:
output.add_text(text)