print name and caps in table

Signed-off-by: Jakub Sokołowski <jakub@status.im>
This commit is contained in:
Jakub Sokołowski 2019-06-20 17:23:37 -04:00 committed by Jakub
parent b7fd7b20ed
commit 1c60834a07
1 changed files with 6 additions and 3 deletions

View File

@ -1,11 +1,14 @@
package main
import "fmt"
import (
"fmt"
"strings"
)
type Peer struct {
Enode string `json:"enode"`
Id peerId `json:"id"`
Name string `json:"na"`
Name string `json:"name"`
Caps []string `json:"caps"`
Network NetworkInfo `json:"netrowkr"`
Protocols map[string]string `json:"protocols"`
@ -18,7 +21,7 @@ func (p Peer) String() string {
type peerId string
func (p Peer) AsTable() string {
return fmt.Sprintf("%15s | what", p.Id)
return fmt.Sprintf("%15s | %30s | %s", p.Id, p.Name, strings.Join(p.Caps, ", "))
}
// the ID is too long to display in full in most places