Add version flag
This commit is contained in:
parent
c08ddfd810
commit
614d14e399
10
main.go
10
main.go
@ -20,6 +20,7 @@ package main
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
_ "embed"
|
_ "embed"
|
||||||
|
"flag"
|
||||||
"fmt"
|
"fmt"
|
||||||
"os"
|
"os"
|
||||||
"strconv"
|
"strconv"
|
||||||
@ -44,6 +45,15 @@ var (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
|
showVer := flag.Bool("version", false, "Show version number and exit")
|
||||||
|
flag.Parse()
|
||||||
|
// If version requested, print and exit
|
||||||
|
if *showVer {
|
||||||
|
fmt.Println(version)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// Initialize infinitime library
|
||||||
infinitime.Init()
|
infinitime.Init()
|
||||||
// Cleanly exit after function
|
// Cleanly exit after function
|
||||||
defer infinitime.Exit()
|
defer infinitime.Exit()
|
||||||
|
Loading…
Reference in New Issue
Block a user