diff options
author | Andrzej Ratajczak <andrzej.ratajczak98@gmail.com> | 2020-05-12 15:19:53 +0200 |
---|---|---|
committer | Kamil Doległo <9080183+kamildoleglo@users.noreply.github.com> | 2020-06-16 11:42:11 +0200 |
commit | 9637ec0747815181d56fa53419d4f6c56705752b (patch) | |
tree | 8d5c151b13322224c1053c9710273be2cf9760bd /core/src/main | |
parent | d20cad929c4c095fbc8a94e4d41938fa3fc39a0c (diff) | |
download | dokka-9637ec0747815181d56fa53419d4f6c56705752b.tar.gz dokka-9637ec0747815181d56fa53419d4f6c56705752b.tar.bz2 dokka-9637ec0747815181d56fa53419d4f6c56705752b.zip |
Refactor CLI
Diffstat (limited to 'core/src/main')
-rw-r--r-- | core/src/main/kotlin/DokkaBootstrapImpl.kt | 41 | ||||
-rw-r--r-- | core/src/main/kotlin/utilities/DokkaLogging.kt | 4 |
2 files changed, 21 insertions, 24 deletions
diff --git a/core/src/main/kotlin/DokkaBootstrapImpl.kt b/core/src/main/kotlin/DokkaBootstrapImpl.kt index d39ee1d5..e0f014c8 100644 --- a/core/src/main/kotlin/DokkaBootstrapImpl.kt +++ b/core/src/main/kotlin/DokkaBootstrapImpl.kt @@ -8,28 +8,25 @@ import org.jetbrains.dokka.utilities.DokkaLogger import java.util.function.BiConsumer -fun parsePerPackageOptions(arg: String): List<PackageOptions> { - if (arg.isBlank()) return emptyList() - - return arg.split(";").map { it.split(",") }.map { - val prefix = it.first() - if (prefix == "") - throw IllegalArgumentException("Please do not register packageOptions with all match pattern, use global settings instead") - val args = it.subList(1, it.size) - val deprecated = args.find { it.endsWith("deprecated") }?.startsWith("+") ?: true - val reportUndocumented = args.find { it.endsWith("reportUndocumented") }?.startsWith("+") ?: true - val privateApi = args.find { it.endsWith("privateApi") }?.startsWith("+") ?: false - val suppress = args.find { it.endsWith("suppress") }?.startsWith("+") ?: false - PackageOptionsImpl( - prefix, - includeNonPublic = privateApi, - reportUndocumented = reportUndocumented, - skipDeprecated = !deprecated, - suppress = suppress - ) - } +fun parsePerPackageOptions(args: List<String>): List<PackageOptions> = args.map { it.split(",") }.map { + val prefix = it.first() + if (prefix == "") + throw IllegalArgumentException("Please do not register packageOptions with all match pattern, use global settings instead") + val args = it.subList(1, it.size) + val deprecated = args.find { it.endsWith("deprecated") }?.startsWith("+") ?: true + val reportUndocumented = args.find { it.endsWith("reportUndocumented") }?.startsWith("+") ?: true + val privateApi = args.find { it.endsWith("privateApi") }?.startsWith("+") ?: false + val suppress = args.find { it.endsWith("suppress") }?.startsWith("+") ?: false + PackageOptionsImpl( + prefix, + includeNonPublic = privateApi, + reportUndocumented = reportUndocumented, + skipDeprecated = !deprecated, + suppress = suppress + ) } + class DokkaBootstrapImpl : DokkaBootstrap { class DokkaProxyLogger(val consumer: BiConsumer<String, String>) : DokkaLogger { @@ -60,9 +57,9 @@ class DokkaBootstrapImpl : DokkaBootstrap { if (warningsCount > 0 || errorsCount > 0) { println( "Generation completed with $warningsCount warning" + - (if (DokkaConsoleLogger.warningsCount == 1) "" else "s") + + (if (warningsCount == 1) "" else "s") + " and $errorsCount error" + - if (DokkaConsoleLogger.errorsCount == 1) "" else "s" + if (errorsCount == 1) "" else "s" ) } else { println("generation completed successfully") diff --git a/core/src/main/kotlin/utilities/DokkaLogging.kt b/core/src/main/kotlin/utilities/DokkaLogging.kt index 1c05c95d..4b671f7b 100644 --- a/core/src/main/kotlin/utilities/DokkaLogging.kt +++ b/core/src/main/kotlin/utilities/DokkaLogging.kt @@ -27,9 +27,9 @@ object DokkaConsoleLogger : DokkaLogger { override fun report() { if (warningsCount > 0 || errorsCount > 0) { - println("Generation completed with warningsCount warning" + + println("Generation completed with $warningsCount warning" + (if(warningsCount == 1) "" else "s") + - " and errorsCount error" + + " and $errorsCount error" + if(errorsCount == 1) "" else "s" ) } else { |