feat: --exclusive switch (#78)

This commit is contained in:
bogadana 2022-07-10 12:15:28 +02:00 committed by GitHub
parent 93a4787780
commit 8e91c12c5e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 5 additions and 4 deletions

View File

@ -67,6 +67,9 @@ internal object MainCommand : Runnable {
@Option(names = ["-e", "--exclude"], description = ["Explicitly exclude patches"]) @Option(names = ["-e", "--exclude"], description = ["Explicitly exclude patches"])
var excludedPatches = arrayOf<String>() var excludedPatches = arrayOf<String>()
@Option(names = ["--exclusive"], description = ["Exclusively include patches"])
var defaultExclude = false
@Option(names = ["-i", "--include"], description = ["Include patches"]) @Option(names = ["-i", "--include"], description = ["Include patches"])
var includedPatches = arrayOf<String>() var includedPatches = arrayOf<String>()

View File

@ -16,7 +16,7 @@ internal object Patcher {
// merge files like necessary integrations // merge files like necessary integrations
patcher.mergeFiles() patcher.mergeFiles()
// add patches, but filter incompatible or excluded patches // add patches, but filter incompatible or excluded patches
patcher.addPatchesFiltered(excludePatches = args.excludedPatches.isNotEmpty()) patcher.addPatchesFiltered()
// apply patches // apply patches
patcher.applyPatchesVerbose() patcher.applyPatchesVerbose()

View File

@ -11,9 +11,7 @@ import app.revanced.patcher.extensions.PatchExtensions.patchName
import app.revanced.patcher.patch.Patch import app.revanced.patcher.patch.Patch
import app.revanced.patcher.util.patch.implementation.JarPatchBundle import app.revanced.patcher.util.patch.implementation.JarPatchBundle
fun Patcher.addPatchesFiltered( fun Patcher.addPatchesFiltered() {
excludePatches: Boolean = false
) {
val packageName = this.data.packageMetadata.packageName val packageName = this.data.packageMetadata.packageName
val packageVersion = this.data.packageMetadata.packageVersion val packageVersion = this.data.packageMetadata.packageVersion