Skip to content

Commit

Permalink
Do not include decoded names in JSON output
Browse files Browse the repository at this point in the history
  • Loading branch information
rustydb committed Jan 25, 2024
1 parent f377d54 commit d15fe73
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion pkg/cmd/cli/bios/amd/epyc/rome/decoder.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ import (
"encoding/json"
"errors"
"fmt"
"github.com/spf13/viper"
"os"
"path"
"strings"
Expand Down Expand Up @@ -129,8 +130,14 @@ func (l *Library) RegisterAttribute(attribute Attribute) error {

// Decode accepts a key and changes it to a friendly name if it exists and json is not requested
func (d DecoderMap) Decode(key string) string {
v := viper.GetViper()

if romeAttr, exists := d.Map.Attributes[key]; exists {
key = fmt.Sprintf("%s (%s)", romeAttr.AttributeName, strings.TrimLeft(romeAttr.DisplayName, " "))
if v.GetBool("json") {
key = romeAttr.AttributeName
} else {
key = fmt.Sprintf("%s (%s)", romeAttr.AttributeName, strings.TrimLeft(romeAttr.DisplayName, " "))
}
}
return key
}
Expand Down

0 comments on commit d15fe73

Please sign in to comment.