diff --git a/src/commonMain/kotlin/teksturepako/pakku/cli/cmd/Diff.kt b/src/commonMain/kotlin/teksturepako/pakku/cli/cmd/Diff.kt index d257f50..b494d70 100644 --- a/src/commonMain/kotlin/teksturepako/pakku/cli/cmd/Diff.kt +++ b/src/commonMain/kotlin/teksturepako/pakku/cli/cmd/Diff.kt @@ -114,11 +114,11 @@ class Diff : CliktCommand("Diff projects in modpack") file.createNewFile() file.outputStream().close() - file.appendText("```diff\n") - added.forEach { file.appendText("+ $it\n") } - removed.forEach { file.appendText("- $it\n") } - updated.forEach { file.appendText("! $it\n") } - file.appendText("```\n") + file.appendText("```diff${File.separator}") + added.forEach { file.appendText("+ $it${File.separator}") } + removed.forEach { file.appendText("- $it${File.separator}") } + updated.forEach { file.appendText("! $it${File.separator}") } + file.appendText("```${File.separator}") } if (markdownOpt != null) @@ -129,20 +129,20 @@ class Diff : CliktCommand("Diff projects in modpack") file.outputStream().close() if (added.isNotEmpty()) { - file.appendText("### Added\n") - added.forEach { file.appendText("- $it\n") } - if (removed.isNotEmpty()) file.appendText("\n") + file.appendText("### Added${File.separator}") + added.forEach { file.appendText("- $it${File.separator}") } + if (removed.isNotEmpty()) file.appendText(File.separator) } if (removed.isNotEmpty()) { - file.appendText("### Removed\n") - removed.forEach { file.appendText("- $it\n") } - if (updated.isNotEmpty()) file.appendText("\n") + file.appendText("### Removed${File.separator}") + removed.forEach { file.appendText("- $it${File.separator}") } + if (updated.isNotEmpty()) file.appendText(File.separator) } if (updated.isNotEmpty()) { - file.appendText("### Updated\n") - updated.forEach { file.appendText("- $it\n") } + file.appendText("### Updated${File.separator}") + updated.forEach { file.appendText("- $it${File.separator}") } } } echo() diff --git a/src/commonMain/kotlin/teksturepako/pakku/cli/cmd/Pakku.kt b/src/commonMain/kotlin/teksturepako/pakku/cli/cmd/Pakku.kt index 0734cc0..7f2f8ea 100644 --- a/src/commonMain/kotlin/teksturepako/pakku/cli/cmd/Pakku.kt +++ b/src/commonMain/kotlin/teksturepako/pakku/cli/cmd/Pakku.kt @@ -13,12 +13,14 @@ import teksturepako.pakku.cli.ui.overrideYes import teksturepako.pakku.cli.ui.pInfo import teksturepako.pakku.debugMode import teksturepako.pakku.io.tryOrNull +import java.io.File import kotlin.io.path.* import kotlin.system.exitProcess class Pakku : CliktCommand() { - init { + init + { versionOption(VERSION, help = "Get pakku version") completionOption(help = "Generate autocompletion scripts") eagerOption( @@ -29,16 +31,13 @@ class Pakku : CliktCommand() } private val yesFlag: Boolean by option( - "-y", "--yes", - help = "Overwrite every prompt to 'yes' without asking" + "-y", "--yes", help = "Overwrite every prompt to 'yes' without asking" ).flag() private val debugFlag: Boolean by option("--debug", help = "Enable additional debug logging").flag() private val workingPathOpt: String? by option( - "--working-path", - help = "Change the working path of Pakku", - metavar = "" + "--working-path", help = "Change the working path of Pakku", metavar = "" ) override fun run() @@ -83,26 +82,26 @@ suspend fun CliktCommand.generateDocs(context: OptionTransformContext) val helpOpt = subcmd.registeredOptions().find { "--help" in it.names } val text = buildString { - append("# pakku $cmdName\n") - append("\n") - append("$cmdHelp\n") - append("\n") - append("## Usage\n") - append("\n") - append("\n") - append("\n") - append("$cmdName\n") - append("$cmdParams\n") - append("\n") - append("\n") - append("\n") - append("\n") + append("# pakku $cmdName${File.separator}") + append(File.separator) + append("$cmdHelp${File.separator}") + append(File.separator) + append("## Usage${File.separator}") + append(File.separator) + append("${File.separator}") + append(File.separator) + append("$cmdName${File.separator}") + append("$cmdParams${File.separator}") + append("${File.separator}") + append(File.separator) + append("${File.separator}") + append(File.separator) if (args.isNotEmpty()) { - append("## Arguments\n") - append("\n") - append("\n") - append("\n") + append("## Arguments${File.separator}") + append(File.separator) + append("${File.separator}") + append(File.separator) for (arg in args) { val argName = buildString { @@ -115,42 +114,42 @@ suspend fun CliktCommand.generateDocs(context: OptionTransformContext) } val argHelp = arg.help.ifBlank { "The `${arg.name.lowercase()}` argument" } - append("$argName\n") - append(": $argHelp\n") - append("\n") + append("$argName${File.separator}") + append(": $argHelp${File.separator}") + append(File.separator) } - append("\n") - append("\n") + append("${File.separator}") + append(File.separator) } - append("## Options\n") - append("\n") - append("\n") - append("\n") + append("## Options${File.separator}") + append(File.separator) + append("${File.separator}") + append(File.separator) if (opts.isNotEmpty()) { - append("\n") - append("\n") + append("${File.separator}") + append(File.separator) for (opt in opts) { val optName = opt.names.joinToString { "`$it`" } val optHelp = opt.optionHelp(context.context) - append("$optName\n") - append(": $optHelp\n") - append("\n") + append("$optName${File.separator}") + append(": $optHelp${File.separator}") + append(File.separator) } - append("\n") - append("\n") + append("${File.separator}") + append(File.separator) } helpOpt?.let { opt -> val optName = opt.names.joinToString { "`$it`" } val optHelp = opt.optionHelp(context.context) - append("$optName\n") - append(": $optHelp\n") - append("\n") + append("$optName${File.separator}") + append(": $optHelp${File.separator}") + append(File.separator) } - append("\n") + File("${File.separator}") append("") }