mirror of
https://github.com/Anvilcraft/modpacktools
synced 2024-11-17 23:41:55 +01:00
clean up CreateModlist.kt
This commit is contained in:
parent
2a561a71c3
commit
1a41b9ca87
1 changed files with 48 additions and 47 deletions
|
@ -25,8 +25,13 @@ class CreateModlist : ICommand {
|
|||
if(outFile.exists())
|
||||
return CommandReturn.fail("File already exists!")
|
||||
|
||||
when(args[1]) {
|
||||
"csv" -> {
|
||||
return if(args[1] == "html")
|
||||
doHtml(outFile)
|
||||
else
|
||||
doCsv(outFile)
|
||||
}
|
||||
|
||||
private fun doCsv(outFile: File): CommandReturn {
|
||||
println("Making CSV file $outFile")
|
||||
val printer = CSVPrinter(FileWriter(outFile), CSVFormat.EXCEL.withDelimiter(';'))
|
||||
|
||||
|
@ -44,7 +49,7 @@ class CreateModlist : ICommand {
|
|||
return CommandReturn.success("Wrote CSV file")
|
||||
}
|
||||
|
||||
"html" -> {
|
||||
private fun doHtml(outFile: File): CommandReturn {
|
||||
println("Making HTML file $outFile")
|
||||
val writer = FileWriter(outFile)
|
||||
val html = body(
|
||||
|
@ -75,10 +80,6 @@ class CreateModlist : ICommand {
|
|||
return CommandReturn.success("Wrote HTML file")
|
||||
}
|
||||
|
||||
else -> throw IllegalStateException("Unreachable")
|
||||
}
|
||||
}
|
||||
|
||||
private fun getMods(): List<AddonscriptJSON.Meta> {
|
||||
val asJson = Main.MPJH.json
|
||||
val mods = ArrayList<AddonscriptJSON.Meta>()
|
||||
|
|
Loading…
Reference in a new issue