From 8e91c12c5e3864c369005ef9fe7d9db668e86701 Mon Sep 17 00:00:00 2001 From: bogadana <30848157+bogadana@users.noreply.github.com> Date: Sun, 10 Jul 2022 12:15:28 +0200 Subject: [PATCH] feat: `--exclusive` switch (#78) --- src/main/kotlin/app/revanced/cli/command/MainCommand.kt | 3 +++ src/main/kotlin/app/revanced/cli/patcher/Patcher.kt | 2 +- src/main/kotlin/app/revanced/utils/patcher/Patcher.kt | 4 +--- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/main/kotlin/app/revanced/cli/command/MainCommand.kt b/src/main/kotlin/app/revanced/cli/command/MainCommand.kt index d7eeace..4b03204 100644 --- a/src/main/kotlin/app/revanced/cli/command/MainCommand.kt +++ b/src/main/kotlin/app/revanced/cli/command/MainCommand.kt @@ -67,6 +67,9 @@ internal object MainCommand : Runnable { @Option(names = ["-e", "--exclude"], description = ["Explicitly exclude patches"]) var excludedPatches = arrayOf() + @Option(names = ["--exclusive"], description = ["Exclusively include patches"]) + var defaultExclude = false + @Option(names = ["-i", "--include"], description = ["Include patches"]) var includedPatches = arrayOf() diff --git a/src/main/kotlin/app/revanced/cli/patcher/Patcher.kt b/src/main/kotlin/app/revanced/cli/patcher/Patcher.kt index 3250166..e006025 100644 --- a/src/main/kotlin/app/revanced/cli/patcher/Patcher.kt +++ b/src/main/kotlin/app/revanced/cli/patcher/Patcher.kt @@ -16,7 +16,7 @@ internal object Patcher { // merge files like necessary integrations patcher.mergeFiles() // add patches, but filter incompatible or excluded patches - patcher.addPatchesFiltered(excludePatches = args.excludedPatches.isNotEmpty()) + patcher.addPatchesFiltered() // apply patches patcher.applyPatchesVerbose() diff --git a/src/main/kotlin/app/revanced/utils/patcher/Patcher.kt b/src/main/kotlin/app/revanced/utils/patcher/Patcher.kt index 8c9005f..3eb2e11 100644 --- a/src/main/kotlin/app/revanced/utils/patcher/Patcher.kt +++ b/src/main/kotlin/app/revanced/utils/patcher/Patcher.kt @@ -11,9 +11,7 @@ import app.revanced.patcher.extensions.PatchExtensions.patchName import app.revanced.patcher.patch.Patch import app.revanced.patcher.util.patch.implementation.JarPatchBundle -fun Patcher.addPatchesFiltered( - excludePatches: Boolean = false -) { +fun Patcher.addPatchesFiltered() { val packageName = this.data.packageMetadata.packageName val packageVersion = this.data.packageMetadata.packageVersion