From 64e455615d67b5fecf0ce38ca3b8d5cacd9b79d2 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Sun, 15 Sep 2024 21:09:11 +0000 Subject: [PATCH] deps: update dependency com.github.ajalt.clikt:clikt to v5 --- cli/src/main/kotlin/ExportCommand.kt | 5 ++++- cli/src/main/kotlin/FilterCommand.kt | 5 ++++- cli/src/main/kotlin/Main.kt | 5 ++++- gradle/libs.versions.toml | 2 +- 4 files changed, 13 insertions(+), 4 deletions(-) diff --git a/cli/src/main/kotlin/ExportCommand.kt b/cli/src/main/kotlin/ExportCommand.kt index 4f87b07..f9cf240 100644 --- a/cli/src/main/kotlin/ExportCommand.kt +++ b/cli/src/main/kotlin/ExportCommand.kt @@ -4,6 +4,7 @@ package dev.schuberth.stan.cli import com.github.ajalt.clikt.core.BadParameterValue import com.github.ajalt.clikt.core.CliktCommand +import com.github.ajalt.clikt.core.Context import com.github.ajalt.clikt.core.requireObject import com.github.ajalt.clikt.parameters.options.convert import com.github.ajalt.clikt.parameters.options.multiple @@ -17,7 +18,9 @@ import dev.schuberth.stan.model.Statement import java.io.ByteArrayOutputStream import java.io.FileOutputStream -class ExportCommand : CliktCommand(name = "export", help = "Export statements to different formats.") { +class ExportCommand : CliktCommand("export") { + override fun help(context: Context) = "Export statements to different formats." + private val exportFormats by option( "--format", "-f", help = "The data format to export to, must be one of ${Exporter.ALL.keys}. If none is specified only " + diff --git a/cli/src/main/kotlin/FilterCommand.kt b/cli/src/main/kotlin/FilterCommand.kt index 581015f..b36e4a6 100644 --- a/cli/src/main/kotlin/FilterCommand.kt +++ b/cli/src/main/kotlin/FilterCommand.kt @@ -1,6 +1,7 @@ package dev.schuberth.stan.cli import com.github.ajalt.clikt.core.CliktCommand +import com.github.ajalt.clikt.core.Context import com.github.ajalt.clikt.core.requireObject import com.github.ajalt.clikt.parameters.options.option import com.github.ajalt.clikt.parameters.types.enum @@ -11,7 +12,9 @@ import dev.schuberth.stan.model.joinInfo import java.time.LocalDate -class FilterCommand : CliktCommand(name = "filter", help = "Filter booking items.") { +class FilterCommand : CliktCommand("filter") { + override fun help(context: Context) = "Filter booking items." + private val from by option( "--from", help = "Start date (inclusive), e.g. '2022-09-01'." diff --git a/cli/src/main/kotlin/Main.kt b/cli/src/main/kotlin/Main.kt index fb0fb1b..ad276c9 100644 --- a/cli/src/main/kotlin/Main.kt +++ b/cli/src/main/kotlin/Main.kt @@ -6,6 +6,7 @@ import com.github.ajalt.clikt.core.CliktCommand import com.github.ajalt.clikt.core.ProgramResult import com.github.ajalt.clikt.core.UsageError import com.github.ajalt.clikt.core.context +import com.github.ajalt.clikt.core.main import com.github.ajalt.clikt.core.subcommands import com.github.ajalt.clikt.output.MordantHelpFormatter import com.github.ajalt.clikt.parameters.arguments.argument @@ -34,7 +35,9 @@ import org.koin.dsl.module fun main(args: Array) = Main().main(args) -class Main : CliktCommand(invokeWithoutSubcommand = true), Logger { +class Main : CliktCommand(), Logger { + override val invokeWithoutSubcommand = true + private val userHome by lazy { val fixedUserHome = System.getProperty("user.home").takeUnless { it.isBlank() || it == "?" } ?: listOfNotNull( System.getenv("HOME"), diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index a55566f..aa88c1f 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -5,7 +5,7 @@ kotlinPlugin = "2.0.20" versionsPlugin = "0.51.0" bouncyCastle = "1.78.1" -clikt = "4.4.0" +clikt = "5.0.0" itextpdf = "5.5.13.4" koinCore = "3.5.6" kotest = "5.9.1"