Files
Terrarum/src/net/torvald/terrarum/console/Batch.kt
Song Minjae 7078ecfed4 Echo().execute(message) is now just Echo(message)
Former-commit-id: 851e141fc91b170190d6027f42f59906dda0f31f
Former-commit-id: 03dbb9da1788e1c50e84ae33d95f76194ad9a08d
2016-12-14 12:40:53 +09:00

25 lines
580 B
Kotlin

package net.torvald.terrarum.console
import java.nio.file.FileSystems
import java.nio.file.Files
/**
* Created by minjaesong on 16-03-07.
*/
internal object Batch : ConsoleCommand {
@Throws(Exception::class)
override fun execute(args: Array<String>) {
if (args.size == 2) {
Files.lines(FileSystems.getDefault().getPath(args[1])).forEach(
{ CommandInterpreter.execute(it) })
}
else {
printUsage()
}
}
override fun printUsage() {
Echo("Usage: batch path/to/batch.txt")
}
}