mirror of
https://github.com/revanced/revanced-cli.git
synced 2025-05-01 07:04:29 +02:00
refactor: apply formatting
This commit is contained in:
parent
76da6c1fa6
commit
3cc98efaa6
@ -6,9 +6,7 @@ import app.revanced.patcher.PatcherOptions
|
||||
import app.revanced.patcher.extensions.PatchExtensions.patchName
|
||||
import app.revanced.patcher.util.patch.implementation.JarPatchBundle
|
||||
import app.revanced.utils.adb.Adb
|
||||
import picocli.CommandLine.Command
|
||||
import picocli.CommandLine.Option
|
||||
import picocli.CommandLine.ArgGroup
|
||||
import picocli.CommandLine.*
|
||||
import java.io.File
|
||||
import java.nio.file.Files
|
||||
|
||||
@ -20,8 +18,7 @@ internal object MainCommand : Runnable {
|
||||
@ArgGroup(exclusive = false, multiplicity = "1")
|
||||
lateinit var args: Args
|
||||
|
||||
class Args
|
||||
{
|
||||
class Args {
|
||||
@Option(names = ["-b", "--bundles"], description = ["One or more bundles of patches"], required = true)
|
||||
var patchBundles = arrayOf<String>()
|
||||
|
||||
@ -34,7 +31,7 @@ internal object MainCommand : Runnable {
|
||||
|
||||
class ListingArgs {
|
||||
@Option(names = ["-l", "--list"], description = ["List patches only"], required = true)
|
||||
public var listOnly: Boolean = false
|
||||
var listOnly: Boolean = false
|
||||
}
|
||||
|
||||
class PatchingArgs {
|
||||
@ -82,19 +79,23 @@ internal object MainCommand : Runnable {
|
||||
}
|
||||
|
||||
override fun run() {
|
||||
try
|
||||
{
|
||||
try {
|
||||
if (args.lArgs.listOnly) {
|
||||
for (patchBundlePath in args.patchBundles) for (patch in JarPatchBundle(patchBundlePath).loadPatches()) {
|
||||
println("[available] ${patch.patchName}")
|
||||
}
|
||||
return
|
||||
}
|
||||
} catch (e: UninitializedPropertyAccessException) {}
|
||||
} catch (_: UninitializedPropertyAccessException) {
|
||||
}
|
||||
|
||||
val args = args.pArgs;
|
||||
val args = args.pArgs
|
||||
|
||||
val patcher = app.revanced.patcher.Patcher(PatcherOptions(args.inputFile, args.cacheDirectory, !args.disableResourcePatching))
|
||||
val patcher = app.revanced.patcher.Patcher(
|
||||
PatcherOptions(
|
||||
args.inputFile, args.cacheDirectory, !args.disableResourcePatching
|
||||
)
|
||||
)
|
||||
|
||||
val outputFile = File(args.outputPath)
|
||||
|
||||
@ -102,7 +103,8 @@ internal object MainCommand : Runnable {
|
||||
Adb(outputFile, patcher.data.packageMetadata.packageName, args.deploy!!, args.install)
|
||||
}
|
||||
|
||||
val patchedFile = if (args.install) File(args.cacheDirectory).resolve("${outputFile.nameWithoutExtension}_raw.apk") else outputFile
|
||||
val patchedFile =
|
||||
if (args.install) File(args.cacheDirectory).resolve("${outputFile.nameWithoutExtension}_raw.apk") else outputFile
|
||||
|
||||
Patcher.start(patcher, patchedFile)
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user