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
1 changed files with 18 additions and 8 deletions

View File

@ -2,7 +2,6 @@ package app.revanced.cli.command
import app.revanced.library.ApkUtils
import app.revanced.library.ApkUtils.applyTo
import app.revanced.library.ApkUtils.sign
import app.revanced.library.Options
import app.revanced.library.Options.setOptions
import app.revanced.library.adb.AdbManager
@ -86,6 +85,7 @@ internal object PatchCommand : Runnable {
names = ["-o", "--out"],
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?) {
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."],
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(
names = ["--keystore-entry-password"],
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(
names = ["--signer"],
@ -308,15 +318,15 @@ internal object PatchCommand : Runnable {
patcherResult.applyTo(this)
}.let { patchedApkFile ->
if (!mount) {
sign(
ApkUtils.signApk(
patchedApkFile,
outputFilePath,
ApkUtils.SigningOptions(
signer,
ApkUtils.KeyStoreDetails(
keystoreFilePath,
keyStorePassword,
alias,
password,
signer,
keyStoreEntryAlias,
keyStoreEntryPassword,
),
)
} else {