-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
28 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
25 changes: 24 additions & 1 deletion
25
src/main/kotlin/club/someoneice/ovo/generator/GeneratorMain.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,27 @@ | ||
package club.someoneice.ovo.generator | ||
|
||
class GeneratorMain { | ||
import java.io.File | ||
|
||
object GeneratorMain { | ||
@JvmStatic | ||
fun main(args: Array<String>) { | ||
val path = if (args.size > 1) args[0] else askForPath() | ||
val file = File(path) | ||
if (!file.exists() || !file.isDirectory) throw IllegalArgumentException("Cannot scan a non-directory!") | ||
|
||
file.listFiles()?.forEach(GeneratorMain::scanFile) | ||
} | ||
|
||
private fun scanFile(file: File) { | ||
if (!file.endsWith(".json") && !file.endsWith(".json5")) return | ||
val fileName = file.nameWithoutExtension | ||
|
||
} | ||
|
||
private fun askForPath(): String { | ||
println("请输入路径:") | ||
while (true) { | ||
readln().apply { if (isEmpty()) return@apply else return@askForPath this } | ||
} | ||
} | ||
} |