This repository was archived by the owner on Feb 21, 2026. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +31
-8
lines changed
cli/src/main/kotlin/io/redgreen/cardbox/cli Expand file tree Collapse file tree 2 files changed +31
-8
lines changed Original file line number Diff line number Diff line change @@ -3,15 +3,22 @@ package io.redgreen.cardbox.cli
33import io.redgreen.cardbox.cli.commands.DiscoverCommand
44import io.redgreen.cardbox.cli.commands.PackCommand
55import picocli.CommandLine.Command
6-
7- internal const val TOOL_VERSION = " 0.1.0"
6+ import picocli.CommandLine.Option
87
98@Command(
109 name = " cardbox" ,
11- mixinStandardHelpOptions = true ,
12- subcommands = [DiscoverCommand ::class , PackCommand ::class ],
13- description = [" Create JARs from Android projects." ],
10+ subcommands = [
11+ DiscoverCommand ::class ,
12+ PackCommand ::class ,
13+ ],
14+ description = [" Create JARs from Android projects for jQAssistant." ],
1415 commandListHeading = " %nCommands:%n%nAvailable commands are:%n" ,
15- version = [" v$TOOL_VERSION " ],
1616)
17- class CardboxCommand
17+ class CardboxCommand {
18+ @Option(
19+ names = [" --version" , " -v" ],
20+ description = [" prints version" ],
21+ versionHelp = true ,
22+ )
23+ var version: Boolean = false
24+ }
Original file line number Diff line number Diff line change 11package io.redgreen.cardbox.cli
22
3+ import java.util.Properties
4+ import kotlin.system.exitProcess
35import picocli.CommandLine
46
57fun main (args : Array <String >) {
6- CommandLine (CardboxCommand ()).execute(* args)
8+ val commandLine = CommandLine (CardboxCommand ())
9+ val exitCode = commandLine.execute(* args)
10+
11+ if (commandLine.isVersionHelpRequested) {
12+ printVersion()
13+ exitProcess(0 )
14+ }
15+
16+ exitProcess(exitCode)
17+ }
18+
19+ fun printVersion () {
20+ val properties = CardboxCommand ::class .java.classLoader
21+ .getResourceAsStream(" version.properties" ).use { Properties ().apply { load(it) } }
22+ println (properties[" version" ])
723}
You can’t perform that action at this time.
0 commit comments