check maxWidth od window to show full peer ID
Signed-off-by: Jakub Sokołowski <jakub@status.im>
This commit is contained in:
parent
1c60834a07
commit
ed94437bdd
10
json.go
10
json.go
|
@ -20,8 +20,14 @@ func (p Peer) String() string {
|
|||
|
||||
type peerId string
|
||||
|
||||
func (p Peer) AsTable() string {
|
||||
return fmt.Sprintf("%15s | %30s | %s", p.Id, p.Name, strings.Join(p.Caps, ", "))
|
||||
func (p Peer) AsTable(maxWidth int) string {
|
||||
var id string
|
||||
if maxWidth > 50 {
|
||||
id = string(p.Id)
|
||||
} else {
|
||||
id = p.Id.String()
|
||||
}
|
||||
return fmt.Sprintf("%15s | %30s | %s", id, p.Name, strings.Join(p.Caps, ", "))
|
||||
}
|
||||
|
||||
// the ID is too long to display in full in most places
|
||||
|
|
Loading…
Reference in New Issue