4
0
Fork 0
mirror of https://github.com/Anvilcraft/modpacktools synced 2024-06-02 18:49:31 +02:00
modpacktools/src/main/kotlin/ley/anvil/modpacktools/commands/Shell.kt
2020-07-29 14:19:56 +02:00

29 lines
945 B
Kotlin

package ley.anvil.modpacktools.commands
import ley.anvil.modpacktools.command.CommandReturn
import ley.anvil.modpacktools.command.CommandReturn.Companion.success
import ley.anvil.modpacktools.command.ICommand
import ley.anvil.modpacktools.command.LoadCommand
import ley.anvil.modpacktools.runCommand
@LoadCommand
object Shell : ICommand {
override val name: String = "shell"
override val helpMessage: String = "opens a shell where mpt commands can be entered in a loop."
override val needsConfig: Boolean = false
override val needsModpackjson: Boolean = false
override fun execute(args: Array<out String>): CommandReturn {
println("enter \'exit\' to exit the shell\n")
while(true) {
print(">>>")
val arg = readLine()!!.split(' ')
if(arg.getOrNull(0) == "exit")
break
runCommand(arg.toTypedArray())
}
return success()
}
}