Skip to content

Commit

Permalink
Make output have leading whitespace for sorting
Browse files Browse the repository at this point in the history
  • Loading branch information
HikariKnight committed Mar 7, 2023
1 parent b284f97 commit 10ae8ad
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions lib/genoutput.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,11 @@ import (
func GenDeviceLine(group int, device *pci.Device) string {
var line string
pciaddrclean := regexp.MustCompile(`^\d+:`)
cleanoutput := regexp.MustCompile(`^IOMMU Group\s{1}\d+:`)

// If the device has no revision, ommit the (rev ID), in both cases we generate the line with device info
if device.Revision != "0x00" {
line = fmt.Sprintf("IOMMU Group %v: %s %s [%s%s]: %s %s [%s:%s] (rev %s)\n",
line = fmt.Sprintf("IOMMU Group % 3d: %s %s [%s%s]: %s %s [%s:%s] (rev %s)\n",
group,
pciaddrclean.ReplaceAllString(device.Address, ""),
device.Subclass.Name,
Expand All @@ -26,7 +27,7 @@ func GenDeviceLine(group int, device *pci.Device) string {
device.Revision[len(device.Revision)-2:],
)
} else {
line = fmt.Sprintf("IOMMU Group %v: %s %s [%s%s]: %s %s [%s:%s]\n",
line = fmt.Sprintf("IOMMU Group % 3d: %s %s [%s%s]: %s %s [%s:%s]\n",
group,
pciaddrclean.ReplaceAllString(device.Address, ""),
device.Subclass.Name,
Expand Down

0 comments on commit 10ae8ad

Please sign in to comment.