add: optional callback for CLI

This commit is contained in:
Lucaskyy 2022-04-11 17:27:12 +02:00 committed by oSumAtrIX
parent 72f3cad3f9
commit 5b28523eea
No known key found for this signature in database
GPG Key ID: A9B3094ACDB604B4

View File

@ -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()) {