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.extensions.PatchExtensions.patchName
|
||||||
import app.revanced.patcher.util.patch.implementation.JarPatchBundle
|
import app.revanced.patcher.util.patch.implementation.JarPatchBundle
|
||||||
import app.revanced.utils.adb.Adb
|
import app.revanced.utils.adb.Adb
|
||||||
import picocli.CommandLine.Command
|
import picocli.CommandLine.*
|
||||||
import picocli.CommandLine.Option
|
|
||||||
import picocli.CommandLine.ArgGroup
|
|
||||||
import java.io.File
|
import java.io.File
|
||||||
import java.nio.file.Files
|
import java.nio.file.Files
|
||||||
|
|
||||||
@ -17,11 +15,10 @@ import java.nio.file.Files
|
|||||||
)
|
)
|
||||||
internal object MainCommand : Runnable {
|
internal object MainCommand : Runnable {
|
||||||
|
|
||||||
@ArgGroup(exclusive = false, multiplicity="1")
|
@ArgGroup(exclusive = false, multiplicity = "1")
|
||||||
lateinit var args: Args
|
lateinit var args: Args
|
||||||
|
|
||||||
class Args
|
class Args {
|
||||||
{
|
|
||||||
@Option(names = ["-b", "--bundles"], description = ["One or more bundles of patches"], required = true)
|
@Option(names = ["-b", "--bundles"], description = ["One or more bundles of patches"], required = true)
|
||||||
var patchBundles = arrayOf<String>()
|
var patchBundles = arrayOf<String>()
|
||||||
|
|
||||||
@ -34,7 +31,7 @@ internal object MainCommand : Runnable {
|
|||||||
|
|
||||||
class ListingArgs {
|
class ListingArgs {
|
||||||
@Option(names = ["-l", "--list"], description = ["List patches only"], required = true)
|
@Option(names = ["-l", "--list"], description = ["List patches only"], required = true)
|
||||||
public var listOnly: Boolean = false
|
var listOnly: Boolean = false
|
||||||
}
|
}
|
||||||
|
|
||||||
class PatchingArgs {
|
class PatchingArgs {
|
||||||
@ -82,19 +79,23 @@ internal object MainCommand : Runnable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun run() {
|
override fun run() {
|
||||||
try
|
try {
|
||||||
{
|
|
||||||
if (args.lArgs.listOnly) {
|
if (args.lArgs.listOnly) {
|
||||||
for (patchBundlePath in args.patchBundles) for (patch in JarPatchBundle(patchBundlePath).loadPatches()) {
|
for (patchBundlePath in args.patchBundles) for (patch in JarPatchBundle(patchBundlePath).loadPatches()) {
|
||||||
println("[available] ${patch.patchName}")
|
println("[available] ${patch.patchName}")
|
||||||
}
|
}
|
||||||
return
|
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)
|
val outputFile = File(args.outputPath)
|
||||||
|
|
||||||
@ -102,7 +103,8 @@ internal object MainCommand : Runnable {
|
|||||||
Adb(outputFile, patcher.data.packageMetadata.packageName, args.deploy!!, args.install)
|
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)
|
Patcher.start(patcher, patchedFile)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user