Skip to content

Commit

Permalink
reportinfo.go: Complete first test model
Browse files Browse the repository at this point in the history
  • Loading branch information
lunarlattice0 committed Oct 17, 2023
1 parent f1fbf6f commit 10d0c47
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 8 deletions.
16 changes: 9 additions & 7 deletions cmd/vinegar/vinegar.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,13 +47,6 @@ func main() {
editor.EditConfig(*configPath)
case "uninstall":
Uninstall()
case "reportinfo":
if report, err := util.GenerateInfo(*configPath); err != nil {
log.Fatal(err) // you have REALLY screwed up now
}
fmt.Println("Please share the information below.")
fmt.Printf("%+v\n", report)
}
// These commands (except player & studio) don't require a configuration,
// but they require a wineprefix, hence wineroot of configuration is required.
case "player", "studio", "exec", "kill", "install-webview2", "winetricks":
Expand Down Expand Up @@ -94,6 +87,15 @@ func main() {
}
case "kill":
pfx.Kill()

case "reportinfo":
if report, err := util.GenerateInfo(*configPath); err != nil {
log.Fatal(err) // you have REALLY screwed up now
}
fmt.Println("Please share the information below.")
fmt.Printf("%+v\n", report)
}

case "install-webview2":
if err := InstallWebview2(&pfx); err != nil {
log.Fatal(err)
Expand Down
12 changes: 11 additions & 1 deletion util/reportinfo.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ import (
"github.com/vinegarhq/vinegar/internal/config"
"os"
"errors"
"regexp"
)

type SysInfo struct {
CPUFlags string
AVXAvailable bool
Distro string //Done
Kernel string // Done
Expand All @@ -29,6 +29,16 @@ func GenerateInfo(currentConfigurationPath string) (SysInfo, error){
//TODO, returns struct Sysinfo.
currentSystem := &SysInfo{}

// Check for AVX
if cpufile, err := os.ReadFile("/proc/cpuinfo"); err != nil {
return SysInfo{}, err
} else {
exp := regexp.MustCompile(`avx`)
matches := exp.FindStringSubmatch(string(cpufile))
currentSystem.AVXAvailable = (len(matches) > 0)
}


// Get Distro
if distro, err := os.ReadFile("/etc/os-release"); err != nil {
return SysInfo{}, err
Expand Down

0 comments on commit 10d0c47

Please sign in to comment.