1
mirror of https://github.com/revanced/revanced-cli synced 2024-12-10 20:03:55 +01:00

fix: Make the patch command work without specifying any selection

This commit is contained in:
oSumAtrIX 2024-09-05 22:54:09 +04:00
parent 74ff94037e
commit ba159a35a9
No known key found for this signature in database
GPG Key ID: A9B3094ACDB604B4

View File

@ -30,7 +30,7 @@ internal object PatchCommand : Runnable {
private lateinit var spec: CommandSpec
@ArgGroup(multiplicity = "0..*")
private lateinit var selection: Set<Selection>
private var selection = emptySet<Selection>()
internal class Selection {
@ArgGroup(exclusive = false, multiplicity = "1")
@ -366,14 +366,14 @@ internal object PatchCommand : Runnable {
packageVersion: String,
): Set<Patch<*>> = buildSet {
val enabledPatchesByName =
selection.asSequence().mapNotNull { it.enabled?.selector?.name }.toSet()
selection.mapNotNull { it.enabled?.selector?.name }.toSet()
val enabledPatchesByIndex =
selection.asSequence().mapNotNull { it.enabled?.selector?.index }.toSet()
selection.mapNotNull { it.enabled?.selector?.index }.toSet()
val disabledPatches =
selection.asSequence().mapNotNull { it.disable?.selector?.name }.toSet()
selection.mapNotNull { it.disable?.selector?.name }.toSet()
val disabledPatchesByIndex =
selection.asSequence().mapNotNull { it.disable?.selector?.index }.toSet()
selection.mapNotNull { it.disable?.selector?.index }.toSet()
this@filterPatchSelection.withIndex().forEach patchLoop@{ (i, patch) ->
val patchName = patch.name!!