fix: Indent patch option description correctly

This commit is contained in:
oSumAtrIX 2024-01-27 03:26:01 +01:00
parent fcf5fe632c
commit bd86ef6fc2
No known key found for this signature in database
GPG Key ID: A9B3094ACDB604B4
3 changed files with 12 additions and 5 deletions

View File

@ -6,6 +6,7 @@ import app.revanced.patcher.patch.annotation.CompatiblePackage
import app.revanced.patcher.patch.annotation.Patch
import app.revanced.patcher.patch.options.PatchOption.PatchExtensions.stringPatchOption
import app.revanced.util.ResourceGroup
import app.revanced.util.Utils.trimIndentMultiline
import app.revanced.util.copyResources
import java.io.File
import java.nio.file.Files
@ -64,10 +65,7 @@ object CustomBrandingPatch : ResourcePatch() {
Each of these folders has to have the following files:
${iconResourceFileNames.joinToString("\n") { "- $it" }}
"""
.split("\n")
.joinToString("\n") { it.trimIndent() } // Remove the leading whitespace from each line.
.trimIndent(), // Remove the leading newline.
""".trimIndentMultiline()
)
override fun execute(context: ResourceContext) {

View File

@ -7,6 +7,7 @@ import app.revanced.patcher.patch.annotation.CompatiblePackage
import app.revanced.patcher.patch.annotation.Patch
import app.revanced.patcher.patch.options.PatchOption.PatchExtensions.stringPatchOption
import app.revanced.util.ResourceGroup
import app.revanced.util.Utils.trimIndentMultiline
import app.revanced.util.copyResources
import java.io.File
@ -56,7 +57,7 @@ object ChangeHeaderPatch : ResourcePatch() {
These folders must contain the following files:
${variants.joinToString("\n") { variant -> "- ${HEADER_NAME}_$variant.png" }}
""".trimIndent(),
""".trimIndentMultiline(),
required = true,
)

View File

@ -0,0 +1,8 @@
package app.revanced.util
internal object Utils {
internal fun String.trimIndentMultiline() =
this.split("\n")
.joinToString("\n") { it.trimIndent() } // Remove the leading whitespace from each line.
.trimIndent() // Remove the leading newline.
}