Add aliases to table format output for target reads (#4416)

This commit is contained in:
Todd committed 2024-02-29 15:52:27 -08:00
1 parent 305bb09c35
commit 24a2089db8
1 file changed
+26
+26
View File
@@ -593,6 +593,20 @@ func printItemTable(item *targets.Target, resp *api.Response) string {
}
}
var aliasMaps []map[string]any
if len(item.Aliases) > 0 {
for _, al := range item.Aliases {
m := map[string]any{
"ID": al.Id,
"Value": al.Value,
}
aliasMaps = append(aliasMaps, m)
}
if l := len("Value"); l > maxLength {
maxLength = l
}
}
ret := []string{
"",
"Target information:",
@@ -619,6 +633,18 @@ func printItemTable(item *targets.Target, resp *api.Response) string {
"",
)
if len(aliasMaps) > 0 {
ret = append(ret,
" Aliases:",
)
for _, m := range aliasMaps {
ret = append(ret,
base.WrapMap(4, maxLength, m),
"",
)
}
}
if len(hostSourceMaps) > 0 {
ret = append(ret,
" Host Sources:",