From e9870adf54b49e948fdb188a7b3ab362ad8af161 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20K=C3=BCrten?= <sebastian@mobanisto.de> Date: Tue, 25 Jul 2023 17:36:02 +0200 Subject: [PATCH] Add --version switch to command line --- .../src/main/kotlin/org/briarproject/briar/desktop/Main.kt | 7 +++++++ .../src/main/resources/strings/BriarDesktop.properties | 1 + 2 files changed, 8 insertions(+) diff --git a/briar-desktop/src/main/kotlin/org/briarproject/briar/desktop/Main.kt b/briar-desktop/src/main/kotlin/org/briarproject/briar/desktop/Main.kt index f0eb6e3fe2..11bd96ef9e 100644 --- a/briar-desktop/src/main/kotlin/org/briarproject/briar/desktop/Main.kt +++ b/briar-desktop/src/main/kotlin/org/briarproject/briar/desktop/Main.kt @@ -50,6 +50,7 @@ import java.time.format.DateTimeFormatter import java.util.logging.Level.ALL import java.util.logging.Level.INFO import java.util.logging.Level.WARNING +import kotlin.system.exitProcess @NonNls private val DEFAULT_DATA_DIR = getProperty("user.home") + separator + ".briar" + separator + "desktop" @@ -63,6 +64,10 @@ private class Main : CliktCommand( private val LOG = KotlinLogging.logger {} } + private val version by option( + "--version", // NON-NLS + help = i18n("main.help.version") + ).flag(default = false) private val debug by option( "--debug", "-d", // NON-NLS help = i18n("main.help.debug") @@ -110,6 +115,8 @@ private class Main : CliktCommand( if (BuildData.GIT_BRANCH == null && BuildData.GIT_TAG == null) LOG.i { " Neither branch nor tag detected" } + if (version) exitProcess(0) + val dataDir = getDataDir() val app = DaggerBriarDesktopApp.builder().desktopCoreModule( diff --git a/briar-desktop/src/main/resources/strings/BriarDesktop.properties b/briar-desktop/src/main/resources/strings/BriarDesktop.properties index 2351baaed2..76edac5b19 100644 --- a/briar-desktop/src/main/resources/strings/BriarDesktop.properties +++ b/briar-desktop/src/main/resources/strings/BriarDesktop.properties @@ -303,6 +303,7 @@ peer.trust.stranger=Stranger # Main main.help.title=Briar Desktop Client +main.help.version=Print version and exit main.help.debug=Enable printing of debug messages main.help.verbose=Print verbose log messages main.help.data=The directory where Briar will store its files. Default: {0} -- GitLab