From 10ae8ad0352c405de5f8b257e17222fbdba144fc Mon Sep 17 00:00:00 2001 From: HikariKnight <2557889+HikariKnight@users.noreply.github.com> Date: Tue, 7 Mar 2023 09:50:12 +0100 Subject: [PATCH] Make output have leading whitespace for sorting --- lib/genoutput.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/genoutput.go b/lib/genoutput.go index 48ab405..8a8cd5b 100644 --- a/lib/genoutput.go +++ b/lib/genoutput.go @@ -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, @@ -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,