Merge remote-tracking branch 'aaronraimist/version-flag'

This commit is contained in:
Tulir Asokan 2020-06-17 13:20:43 +03:00
commit f8b386a08f

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.