aboutsummaryrefslogtreecommitdiff
path: root/internal
diff options
context:
space:
mode:
authorS7evinK <tfaelligen@gmail.com>2020-11-16 10:54:58 +0100
committerGitHub <noreply@github.com>2020-11-16 09:54:58 +0000
commitcb41c992f757b3007f01460c140a06b1598d15c8 (patch)
tree0d87b253f711fbe533d47f9831026a18ca718288 /internal
parentb7e288084cc2c9f146d1aad134eace6d670c008b (diff)
Add -version flag (#1581)
Signed-off-by: Till Faelligen <tfaelligen@gmail.com>
Diffstat (limited to 'internal')
-rw-r--r--internal/setup/flags.go14
1 files changed, 12 insertions, 2 deletions
diff --git a/internal/setup/flags.go b/internal/setup/flags.go
index e4fc58d6..c6ecb5cd 100644
--- a/internal/setup/flags.go
+++ b/internal/setup/flags.go
@@ -16,18 +16,28 @@ package setup
import (
"flag"
+ "fmt"
+ "os"
+ "github.com/matrix-org/dendrite/internal"
"github.com/matrix-org/dendrite/internal/config"
-
"github.com/sirupsen/logrus"
)
-var configPath = flag.String("config", "dendrite.yaml", "The path to the config file. For more information, see the config file in this repository.")
+var (
+ configPath = flag.String("config", "dendrite.yaml", "The path to the config file. For more information, see the config file in this repository.")
+ version = flag.Bool("version", false, "Shows the current version and exits immediately.")
+)
// ParseFlags parses the commandline flags and uses them to create a config.
func ParseFlags(monolith bool) *config.Dendrite {
flag.Parse()
+ if *version {
+ fmt.Println(internal.VersionString())
+ os.Exit(0)
+ }
+
if *configPath == "" {
logrus.Fatal("--config must be supplied")
}