[VOL-4667] Implemented default ordering in voltctl for device, logicaldevice and flows list commands output
Change-Id: I0e4b3271a1e15d8f1ba065f244f0181140c4775d
diff --git a/internal/pkg/commands/devices.go b/internal/pkg/commands/devices.go
index 448b900..7acac8c 100644
--- a/internal/pkg/commands/devices.go
+++ b/internal/pkg/commands/devices.go
@@ -33,6 +33,7 @@
const (
DEFAULT_DEVICE_FORMAT = "table{{ .Id }}\t{{.Type}}\t{{.Root}}\t{{.ParentId}}\t{{.SerialNumber}}\t{{.AdminState}}\t{{.OperStatus}}\t{{.ConnectStatus}}\t{{.Reason}}"
+ DEFAULT_DEVICE_ORDER = "Type,Id"
DEFAULT_DEVICE_PORTS_FORMAT = "table{{.PortNo}}\t{{.Label}}\t{{.Type}}\t{{.AdminState}}\t{{.OperStatus}}\t{{.DeviceId}}\t{{.Peers}}"
DEFAULT_DEVICE_INSPECT_FORMAT = `ID: {{.Id}}
TYPE: {{.Type}}
@@ -704,7 +705,7 @@
orderBy := options.OrderBy
if orderBy == "" {
- orderBy = GetCommandOptionWithDefault("device-list", "order", "")
+ orderBy = GetCommandOptionWithDefault("device-list", "order", DEFAULT_DEVICE_ORDER)
}
// Make sure json output prints an empty list, not "null"