feat: Use more consistent option name

This commit is contained in:
oSumAtrIX 2024-03-14 12:49:50 +01:00
parent 45a2ffa2dd
commit 223629c663
No known key found for this signature in database
GPG Key ID: A9B3094ACDB604B4

View File

@ -2,7 +2,6 @@ package app.revanced.cli.command
import app.revanced.library.ApkUtils import app.revanced.library.ApkUtils
import app.revanced.library.ApkUtils.applyTo import app.revanced.library.ApkUtils.applyTo
import app.revanced.library.ApkUtils.sign
import app.revanced.library.Options import app.revanced.library.Options
import app.revanced.library.Options.setOptions import app.revanced.library.Options.setOptions
import app.revanced.library.adb.AdbManager import app.revanced.library.adb.AdbManager
@ -86,6 +85,7 @@ internal object PatchCommand : Runnable {
names = ["-o", "--out"], names = ["-o", "--out"],
description = ["Path to save the patched APK file to. Defaults to the same directory as the supplied APK file."], description = ["Path to save the patched APK file to. Defaults to the same directory as the supplied APK file."],
) )
@Suppress("unused")
private fun setOutputFilePath(outputFilePath: File?) { private fun setOutputFilePath(outputFilePath: File?) {
this.outputFilePath = outputFilePath?.absoluteFile this.outputFilePath = outputFilePath?.absoluteFile
} }
@ -126,13 +126,23 @@ internal object PatchCommand : Runnable {
description = ["The alias of the keystore entry to sign the patched APK file with."], description = ["The alias of the keystore entry to sign the patched APK file with."],
showDefaultValue = ALWAYS, showDefaultValue = ALWAYS,
) )
private var alias = "ReVanced Key" private fun setKeyStoreEntryAlias(alias: String = "ReVanced Key") {
logger.warning("The --alias option is deprecated. Use --keystore-entry-alias instead.")
keyStoreEntryAlias = alias
}
@CommandLine.Option(
names = ["--keystore-entry-alias"],
description = ["The alias of the keystore entry to sign the patched APK file with."],
showDefaultValue = ALWAYS,
)
private var keyStoreEntryAlias = "ReVanced Key"
@CommandLine.Option( @CommandLine.Option(
names = ["--keystore-entry-password"], names = ["--keystore-entry-password"],
description = ["The password of the entry from the keystore for the key to sign the patched APK file with."], description = ["The password of the entry from the keystore for the key to sign the patched APK file with."],
) )
private var password = "" // Empty password by default private var keyStoreEntryPassword = "" // Empty password by default
@CommandLine.Option( @CommandLine.Option(
names = ["--signer"], names = ["--signer"],
@ -308,15 +318,15 @@ internal object PatchCommand : Runnable {
patcherResult.applyTo(this) patcherResult.applyTo(this)
}.let { patchedApkFile -> }.let { patchedApkFile ->
if (!mount) { if (!mount) {
sign( ApkUtils.signApk(
patchedApkFile, patchedApkFile,
outputFilePath, outputFilePath,
ApkUtils.SigningOptions( signer,
ApkUtils.KeyStoreDetails(
keystoreFilePath, keystoreFilePath,
keyStorePassword, keyStorePassword,
alias, keyStoreEntryAlias,
password, keyStoreEntryPassword,
signer,
), ),
) )
} else { } else {