Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

quick update with global version access #24

Merged
merged 9 commits into from
Mar 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions .goreleaser.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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`.
Expand Down
9 changes: 7 additions & 2 deletions cmd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package main

import (
"fmt"
"os"

internal "github.com/HikariKnight/quickpassthrough/internal"
downloader "github.com/HikariKnight/quickpassthrough/internal/ls_iommu_downloader"
Expand All @@ -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()
}
Expand Down
6 changes: 3 additions & 3 deletions internal/params/params.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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)
Expand Down
Loading