Skip to content

Commit

Permalink
feat: Use more consistent option name
Browse files Browse the repository at this point in the history
  • Loading branch information
oSumAtrIX committed Mar 14, 2024
1 parent 45a2ffa commit 223629c
Showing 1 changed file with 18 additions and 8 deletions.
26 changes: 18 additions & 8 deletions src/main/kotlin/app/revanced/cli/command/PatchCommand.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
}
Expand Down Expand Up @@ -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"],
Expand Down Expand Up @@ -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 {
Expand Down

0 comments on commit 223629c

Please sign in to comment.