mirror of
https://github.com/mainnika/nikita-tokarch-uk.git
synced 2026-05-25 01:03:35 +00:00
Print app version if requested by flags
This commit is contained in:
@@ -1,14 +1,25 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/sirupsen/logrus"
|
||||
"github.com/spf13/viper"
|
||||
)
|
||||
|
||||
var Version = "nightly"
|
||||
|
||||
func main() {
|
||||
|
||||
if viper.GetBool("version") {
|
||||
fmt.Print(Version)
|
||||
return
|
||||
}
|
||||
|
||||
viper.SetConfigFile(viper.GetString("config"))
|
||||
if err := viper.ReadInConfig(); err != nil {
|
||||
logrus.Debugf("Skip invalid config file %s, %v", viper.ConfigFileUsed(), err)
|
||||
}
|
||||
|
||||
logrus.Infof("Version: %s", Version)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user