mirror of
https://github.com/revanced/revanced-cli.git
synced 2024-11-19 01:59:25 +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
|
||||
|
||||
@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(
|
||||
description = ["APK file to be patched"], arity = "1..1"
|
||||
)
|
||||
@ -179,6 +186,16 @@ internal object PatchCommand : Runnable {
|
||||
|
||||
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")
|
||||
|
||||
optionsFile.let {
|
||||
|
Loading…
Reference in New Issue
Block a user