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

pull/4470/head
Todd 2 years ago
parent 305bb09c35
commit 24a2089db8

@ -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:",

Loading…
Cancel
Save