From f1dadba1b2c7c1953aa5b6e1ea936c9343f583be Mon Sep 17 00:00:00 2001 From: Shantanu Gadgil Date: Thu, 31 Aug 2023 22:30:41 +0530 Subject: [PATCH] inbucket cmd: add version flag (#385) --- cmd/inbucket/main.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/cmd/inbucket/main.go b/cmd/inbucket/main.go index 88ce6a6..ce6933f 100644 --- a/cmd/inbucket/main.go +++ b/cmd/inbucket/main.go @@ -49,6 +49,7 @@ func init() { func main() { // Command line flags. help := flag.Bool("help", false, "Displays help on flags and env variables.") + versionflag := flag.Bool("version", false, "Displays version.") pidfile := flag.String("pidfile", "", "Write our PID into the specified file.") logfile := flag.String("logfile", "stderr", "Write out log into the specified file.") logjson := flag.Bool("logjson", false, "Logs are written in JSON format.") @@ -64,6 +65,10 @@ func main() { config.Usage() return } + if *versionflag { + fmt.Fprintln(os.Stdout, version) + return + } // Process configuration. config.Version = version