Skip to content

Commit

Permalink
Add Features to JSON output (#94)
Browse files Browse the repository at this point in the history
.. and X64Level
  • Loading branch information
klauspost committed Feb 8, 2022
1 parent 1a69123 commit a4e6a85
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion cmd/cpuid/main.go
Expand Up @@ -25,7 +25,16 @@ var js = flag.Bool("json", false, "Output as JSON")
func main() {
flag.Parse()
if *js {
b, err := json.MarshalIndent(cpuid.CPU, "", " ")
info := struct {
cpuid.CPUInfo
Features []string
X64Level int
}{
CPUInfo: cpuid.CPU,
Features: cpuid.CPU.FeatureSet(),
X64Level: cpuid.CPU.X64Level(),
}
b, err := json.MarshalIndent(info, "", " ")
if err != nil {
panic(err)
}
Expand Down

0 comments on commit a4e6a85

Please sign in to comment.