From 57a1e7c27fb0c4292e08332b88ccd57d69fa02c6 Mon Sep 17 00:00:00 2001 From: bogadana <30848157+bogadana@users.noreply.github.com> Date: Sun, 3 Jul 2022 15:49:25 +0200 Subject: [PATCH] feat: `--include` option (#76) --- src/main/kotlin/app/revanced/cli/command/MainCommand.kt | 3 +++ src/main/kotlin/app/revanced/utils/patcher/Patcher.kt | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/main/kotlin/app/revanced/cli/command/MainCommand.kt b/src/main/kotlin/app/revanced/cli/command/MainCommand.kt index 5e43820e..5eaacf3b 100644 --- a/src/main/kotlin/app/revanced/cli/command/MainCommand.kt +++ b/src/main/kotlin/app/revanced/cli/command/MainCommand.kt @@ -57,6 +57,9 @@ internal object MainCommand : Runnable { @Option(names = ["-e", "--exclude"], description = ["Explicitly exclude patches"]) var excludedPatches = arrayOf() + @Option(names = ["-i", "--include"], description = ["Include patches"]) + var includedPatches = arrayOf() + @Option(names = ["-r", "--resource-patcher"], description = ["Disable patching resources"]) var disableResourcePatching: Boolean = false diff --git a/src/main/kotlin/app/revanced/utils/patcher/Patcher.kt b/src/main/kotlin/app/revanced/utils/patcher/Patcher.kt index 5f06595b..d3ae5897 100644 --- a/src/main/kotlin/app/revanced/utils/patcher/Patcher.kt +++ b/src/main/kotlin/app/revanced/utils/patcher/Patcher.kt @@ -30,7 +30,7 @@ fun Patcher.addPatchesFiltered( if (excludePatches && args.excludedPatches.contains(patchName)) { logger.info("$prefix: Explicitly excluded") return@patch - } else if (!patch.include) { + } else if (!patch.include && !args.includedPatches.contains(patchName)) { logger.info("$prefix: Explicitly excluded") return@patch }