Add --version flag

This commit is contained in:
Aaron Raimist 2020-06-13 23:36:43 -05:00
parent 2f48e13764
commit 1e110a4799
No known key found for this signature in database
GPG Key ID: 37419210002890EF

View File

@ -18,6 +18,7 @@ package main
import ( import (
"errors" "errors"
"flag"
"fmt" "fmt"
"os" "os"
"path/filepath" "path/filepath"
@ -74,6 +75,14 @@ func main() {
gmx := NewGomuks(MainUIProvider, configDir, dataDir, cacheDir, downloadDir) gmx := NewGomuks(MainUIProvider, configDir, dataDir, cacheDir, downloadDir)
isVersion := flag.Bool("version", false, "Display gomuks version and exit")
flag.Parse()
if *isVersion {
fmt.Printf("gomuks version %s\n", gmx.Version())
os.Exit(0)
}
gmx.Start() gmx.Start()
// We use os.Exit() everywhere, so exiting by returning from Start() shouldn't happen. // We use os.Exit() everywhere, so exiting by returning from Start() shouldn't happen.