Skip to content

Commit

Permalink
add: optional callback for CLI
Browse files Browse the repository at this point in the history
  • Loading branch information
Sculas authored and oSumAtrIX committed Jun 5, 2022
1 parent 72f3cad commit 5b28523
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/main/kotlin/app/revanced/patcher/Patcher.kt
Original file line number Diff line number Diff line change
Expand Up @@ -100,9 +100,10 @@ class Patcher(
* Apply patches loaded into the patcher.
* @param stopOnError If true, the patches will stop on the first error.
*/
fun applyPatches(stopOnError: Boolean = false): Map<String, Result<PatchResult>> {
fun applyPatches(stopOnError: Boolean = false, callback: (String) -> Unit = {}): Map<String, Result<PatchResult>> {
return buildMap {
for (patch in patches) {
callback(patch.patchName)
val result: Result<PatchResult> = try {
val pr = patch.execute(cache)
if (pr.isSuccess()) {
Expand Down

0 comments on commit 5b28523

Please sign in to comment.