Use flag '-v'
This commit is contained in:
parent
12098aec70
commit
4a66fc4566
9
main.go
9
main.go
@ -6,6 +6,7 @@ import (
|
||||
"mqttListener/models"
|
||||
"mqttListener/mqtt"
|
||||
|
||||
"flag"
|
||||
"fmt"
|
||||
"log"
|
||||
|
||||
@ -38,6 +39,7 @@ var BuildDate string
|
||||
// Version holds contents of ./VERSION file, if exists, or the value passed via the -version option
|
||||
var Version string
|
||||
|
||||
// PrintVersion prints version information
|
||||
func PrintVersion() {
|
||||
var versionString string = GitSummary
|
||||
fmt.Println("\n--------------------------------------------------------")
|
||||
@ -53,6 +55,13 @@ func PrintVersion() {
|
||||
// ---------------------------------------------------------------------------
|
||||
func main() {
|
||||
|
||||
versionFlagPtr := flag.Bool("v", false, "print version")
|
||||
flag.Parse()
|
||||
if *versionFlagPtr {
|
||||
PrintVersion()
|
||||
os.Exit(0)
|
||||
}
|
||||
|
||||
PrintVersion()
|
||||
|
||||
c := make(chan os.Signal, 1)
|
||||
|
Loading…
Reference in New Issue
Block a user