mirror of
https://github.com/revanced/revanced-cli.git
synced 2025-01-08 10:15:49 +01:00
feat: Add option to warn about patches not being found in supplied patch bundles
This commit is contained in:
parent
80a8d88406
commit
e46d855643
@ -124,6 +124,13 @@ internal object PatchCommand : Runnable {
|
|||||||
)
|
)
|
||||||
private var purge: Boolean = false
|
private var purge: Boolean = false
|
||||||
|
|
||||||
|
@CommandLine.Option(
|
||||||
|
names = ["-w", "--warn"],
|
||||||
|
description = ["Warn if a patch can not be found in the supplied patch bundles"],
|
||||||
|
showDefaultValue = ALWAYS
|
||||||
|
)
|
||||||
|
private var warn: Boolean = false
|
||||||
|
|
||||||
@CommandLine.Parameters(
|
@CommandLine.Parameters(
|
||||||
description = ["APK file to be patched"], arity = "1..1"
|
description = ["APK file to be patched"], arity = "1..1"
|
||||||
)
|
)
|
||||||
@ -179,6 +186,16 @@ internal object PatchCommand : Runnable {
|
|||||||
|
|
||||||
val patches = PatchBundleLoader.Jar(*patchBundles.toTypedArray())
|
val patches = PatchBundleLoader.Jar(*patchBundles.toTypedArray())
|
||||||
|
|
||||||
|
// Warn if a patch can not be found in the supplied patch bundles.
|
||||||
|
if (warn) patches.map { it.name }.toHashSet().let { availableNames ->
|
||||||
|
arrayOf(*includedPatches, *excludedPatches).filter { name ->
|
||||||
|
!availableNames.contains(name)
|
||||||
|
}
|
||||||
|
}.let { unknownPatches ->
|
||||||
|
if (unknownPatches.isEmpty()) return@let
|
||||||
|
logger.warning("Unknown input of patches:\n${unknownPatches.joinToString("\n")}")
|
||||||
|
}
|
||||||
|
|
||||||
logger.info("Setting patch options")
|
logger.info("Setting patch options")
|
||||||
|
|
||||||
optionsFile.let {
|
optionsFile.let {
|
||||||
|
Loading…
Reference in New Issue
Block a user