Add version flag

This commit is contained in:
Elara 2022-02-22 08:43:29 -08:00
parent b1d2fe6efb
commit 08dce2a110

10
main.go
View File

@ -20,6 +20,7 @@ package main
import (
_ "embed"
"flag"
"fmt"
"os"
"strconv"
@ -44,6 +45,15 @@ var (
)
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()
// Cleanly exit after function
defer infinitime.Exit()