mirror of
https://github.com/revanced/revanced-patcher.git
synced 2025-05-25 11:22:10 +02:00
add: optional callback for CLI
This commit is contained in:
parent
72f3cad3f9
commit
5b28523eea
@ -100,9 +100,10 @@ class Patcher(
|
|||||||
* Apply patches loaded into the patcher.
|
* Apply patches loaded into the patcher.
|
||||||
* @param stopOnError If true, the patches will stop on the first error.
|
* @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 {
|
return buildMap {
|
||||||
for (patch in patches) {
|
for (patch in patches) {
|
||||||
|
callback(patch.patchName)
|
||||||
val result: Result<PatchResult> = try {
|
val result: Result<PatchResult> = try {
|
||||||
val pr = patch.execute(cache)
|
val pr = patch.execute(cache)
|
||||||
if (pr.isSuccess()) {
|
if (pr.isSuccess()) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user