Skip to content

Commit

Permalink
fix: Indent patch option description correctly
Browse files Browse the repository at this point in the history
  • Loading branch information
oSumAtrIX committed Jan 27, 2024
1 parent fcf5fe6 commit bd86ef6
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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,
)

Expand Down
8 changes: 8 additions & 0 deletions src/main/kotlin/app/revanced/util/Utils.kt
Original file line number Diff line number Diff line change
@@ -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.
}

0 comments on commit bd86ef6

Please sign in to comment.