mirror of
https://github.com/revanced/revanced-cli.git
synced 2024-06-02 11:26:06 +02:00
39 lines
1.1 KiB
Kotlin
39 lines
1.1 KiB
Kotlin
package app.revanced.cli.command
|
|
|
|
import app.revanced.cli.command.utility.UtilityCommand
|
|
import app.revanced.lib.logging.Logger
|
|
import picocli.CommandLine
|
|
import picocli.CommandLine.Command
|
|
import picocli.CommandLine.IVersionProvider
|
|
import java.util.*
|
|
|
|
|
|
fun main(args: Array<String>) {
|
|
Logger.setDefault()
|
|
CommandLine(MainCommand).execute(*args)
|
|
}
|
|
|
|
private object CLIVersionProvider : IVersionProvider {
|
|
override fun getVersion() = arrayOf(
|
|
MainCommand::class.java.getResourceAsStream(
|
|
"/app/revanced/cli/version.properties"
|
|
)?.use { stream ->
|
|
Properties().apply { load(stream) }.let {
|
|
"ReVanced CLI v${it.getProperty("version")}"
|
|
}
|
|
} ?: "ReVanced CLI")
|
|
}
|
|
|
|
@Command(
|
|
name = "revanced-cli",
|
|
description = ["Command line application to use ReVanced"],
|
|
mixinStandardHelpOptions = true,
|
|
versionProvider = CLIVersionProvider::class,
|
|
subcommands = [
|
|
ListPatchesCommand::class,
|
|
PatchCommand::class,
|
|
OptionsCommand::class,
|
|
UtilityCommand::class,
|
|
]
|
|
)
|
|
private object MainCommand |