added basic help command
This commit is contained in:
@@ -13,7 +13,7 @@ var fileSystem: Dictionary = {
|
||||
"special": {
|
||||
"notes.txt": "test",
|
||||
"secrets": {
|
||||
"password.txt": 123
|
||||
"password.txt": "123"
|
||||
}
|
||||
}
|
||||
},
|
||||
@@ -26,6 +26,7 @@ func _ready() -> void:
|
||||
terminalLine.text = "user@work "+ directory + " "
|
||||
UpdateCaretPos()
|
||||
blink_timer.start()
|
||||
Help()
|
||||
|
||||
# --- Caret Blinking Logic ---
|
||||
func _on_caret_timer_timeout() -> void:
|
||||
@@ -94,6 +95,10 @@ func EnterCommand() -> void:
|
||||
for child in historyContainer.get_children():
|
||||
if child != terminalLine:
|
||||
child.queue_free()
|
||||
"help":
|
||||
|
||||
Help()
|
||||
|
||||
"":
|
||||
pass
|
||||
_:
|
||||
@@ -182,6 +187,23 @@ func RetrieveData(inputPath: String):
|
||||
else:
|
||||
CreateHistoryEntry("cat: " + targetFileName + ": No such file or directory")
|
||||
|
||||
func Help(commandName: String = "default"):
|
||||
for child in historyContainer.get_children():
|
||||
if child != terminalLine:
|
||||
child.queue_free()
|
||||
match commandName:
|
||||
"default": CreateHistoryEntry("--- AVAILABLE COMMANDS ---
|
||||
ls (or list) [folder] : List all files and directories/folders
|
||||
cd [folder] : Change directory (use '..' to go up a directory/folder)
|
||||
cat (or view) [file] : Read the contents of a file
|
||||
clear (or cls) : Clear the terminal screen
|
||||
help : Show this menu
|
||||
-------------------------")
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
func UpdateCaretPos():
|
||||
var last_char_index = terminalLine.text.length() - 1
|
||||
var char_rect = terminalLine.get_character_bounds(max(0, last_char_index))
|
||||
|
||||
Reference in New Issue
Block a user