generated from rnentjes/kotlin-server-web-undertow
Add debug println statements in Shell.execCommand and adjust ConsoleView input handling
This commit is contained in:
@@ -77,6 +77,7 @@ object Shell {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fun execCommand(command: String, computer: MonTanaMiniComputer) {
|
fun execCommand(command: String, computer: MonTanaMiniComputer) {
|
||||||
|
println("Exec: $command")
|
||||||
val tokens = MTMCTokenizer(command, "#")
|
val tokens = MTMCTokenizer(command, "#")
|
||||||
try {
|
try {
|
||||||
val identifier = tokens.matchAndConsume(MTMCToken.TokenType.IDENTIFIER)
|
val identifier = tokens.matchAndConsume(MTMCToken.TokenType.IDENTIFIER)
|
||||||
@@ -101,6 +102,7 @@ object Shell {
|
|||||||
if (isCommand(cmd)) {
|
if (isCommand(cmd)) {
|
||||||
COMMANDS[cmd.lowercase()]!!.exec(tokens, computer)
|
COMMANDS[cmd.lowercase()]!!.exec(tokens, computer)
|
||||||
} else {
|
} else {
|
||||||
|
println("Executing: $command")
|
||||||
tokens.reset()
|
tokens.reset()
|
||||||
val asm = mutableListOf<MTMCToken>()
|
val asm = mutableListOf<MTMCToken>()
|
||||||
asm.addAll(tokens.tokens)
|
asm.addAll(tokens.tokens)
|
||||||
|
|||||||
@@ -53,10 +53,10 @@ class ConsoleView(
|
|||||||
|
|
||||||
private fun handleCommand() {
|
private fun handleCommand() {
|
||||||
history.add(input)
|
history.add(input)
|
||||||
input = ""
|
|
||||||
|
|
||||||
Shell.execCommand(input, computer)
|
Shell.execCommand(input, computer)
|
||||||
|
|
||||||
|
input = ""
|
||||||
mainView.requestUpdate()
|
mainView.requestUpdate()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user