Skip to content

Commit

Permalink
fix: Make the patch command work without specifying any selection
Browse files Browse the repository at this point in the history
  • Loading branch information
oSumAtrIX committed Sep 5, 2024
1 parent 74ff940 commit ba159a3
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/main/kotlin/app/revanced/cli/command/PatchCommand.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down Expand Up @@ -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!!
Expand Down

0 comments on commit ba159a3

Please sign in to comment.