From acac0d21e90b26f9f2d792d9c18ae4fb9bbb0160 Mon Sep 17 00:00:00 2001 From: George Sun Date: Fri, 8 Mar 2024 18:20:48 +0800 Subject: [PATCH] Provide a flag to show the current version. --- main.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/main.go b/main.go index f31c8df..a3c4636 100644 --- a/main.go +++ b/main.go @@ -106,6 +106,7 @@ func init() { pflag.Bool("start-disabled", false, "Whether or not to start the server disabled") pflag.Bool("debug", false, "Start the server in debug mode") pflag.Bool("once", false, "Run Ansible Puller just once, then exit") + pflag.Bool("version", false, "Print the build version, then exit") err := viper.ReadInConfig() if err != nil { @@ -287,6 +288,11 @@ func ansibleRun() error { } func main() { + if viper.GetBool("version") { + fmt.Println(Version) + return + } + if viper.GetBool("once") { if err := ansibleRun(); err != nil { logrus.Fatalln("Ansible run failed due to: " + err.Error())