diff --git a/.goreleaser.yaml b/.goreleaser.yaml index a56219d..2048a0e 100644 --- a/.goreleaser.yaml +++ b/.goreleaser.yaml @@ -18,10 +18,9 @@ builds: - linux goarch: - amd64 - ldflags: - - -s -w -X version.Version={{ .Tag }} mod_timestamp: "{{ .CommitTimestamp }}" - + ldflags: + - -s -w -X github.com/HikariKnight/quickpassthrough/internal/version.Version={{.Version}} archives: - format: tar.gz # this name template makes the OS and Arch compatible with the results of `uname`. diff --git a/cmd/main.go b/cmd/main.go index fd13cda..eec1015 100644 --- a/cmd/main.go +++ b/cmd/main.go @@ -2,6 +2,7 @@ package main import ( "fmt" + "os" internal "github.com/HikariKnight/quickpassthrough/internal" downloader "github.com/HikariKnight/quickpassthrough/internal/ls_iommu_downloader" @@ -13,9 +14,13 @@ func main() { // Get all our arguments in 1 neat struct pArg := params.NewParams() + // Display the version if pArg.Flag["version"] { - fmt.Printf("Quickpassthrough version: %s\n", version.Version) - } else { + fmt.Printf("QuickPassthrough Version %s\n", version.Version) + os.Exit(0) + } + + if !pArg.Flag["gui"] { downloader.CheckLsIOMMU() internal.Tui() } diff --git a/internal/params/params.go b/internal/params/params.go index cd28cfa..d6b2aae 100644 --- a/internal/params/params.go +++ b/internal/params/params.go @@ -56,7 +56,7 @@ func NewParams() *Params { // Add version flag version := parser.Flag("v", "version", &argparse.Options{ Required: false, - Help: "Display version", + Help: "Display the version", }) // Parse arguments @@ -78,9 +78,9 @@ func NewParams() *Params { } // Add all parsed arguments to a struct for portability since we will use them all over the program + pArg.addFlag("gui", *gui) pArg.addFlag("version", *version) - /*pArg.addFlag("gui", *gui) - pArg.addFlag("gpu", *gpu) + /*pArg.addFlag("gpu", *gpu) pArg.addFlag("usb", *usb) pArg.addFlag("nic", *nic) pArg.addFlag("sata", *sata)