From b3edc455262b0443ac2baddba96cc2d7e350ef13 Mon Sep 17 00:00:00 2001 From: Bohdan Horbeshko Date: Fri, 22 Apr 2022 19:07:22 -0400 Subject: [PATCH] =?UTF-8?q?Add=20version=20flag=20(specially=20f=C3=BCr=20?= =?UTF-8?q?sava)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- telegabber.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/telegabber.go b/telegabber.go index 97a082b..f76fcbe 100644 --- a/telegabber.go +++ b/telegabber.go @@ -15,6 +15,8 @@ import ( goxmpp "gosrc.io/xmpp" ) +const version string = "1.2.1-dev" + var sm *goxmpp.StreamManager var component *goxmpp.Component var err error @@ -28,8 +30,14 @@ func main() { var configPath = flag.String("config", "config.yml", "Config file path") // JSON schema (not for editing by a user) var schemaPath = flag.String("schema", "./config_schema.json", "Schema file path") + var versionFlag = flag.Bool("version", false, "Print the version and exit") flag.Parse() + if *versionFlag { + fmt.Printf("%v\n", version) + os.Exit(0) + } + if *profilingPort > 0 { go func() { log.Println(http.ListenAndServe(fmt.Sprintf("localhost:%v", *profilingPort), nil))