cmd/tailscale/cli: tweak the status name column a bit

* make peers without DNS names show their hostnames as always one column, for cut/etc users
* remove trailing dot from shared peers' DNS names
This commit is contained in:
Brad Fitzpatrick 2021-01-15 07:46:58 -08:00
parent 420c7a35e2
commit a45665426b

View File

@ -206,9 +206,9 @@ func dnsOrQuoteHostname(st *ipnstate.Status, ps *ipnstate.PeerStatus) string {
return ps.DNSName[:i] return ps.DNSName[:i]
} }
if ps.DNSName != "" { if ps.DNSName != "" {
return ps.DNSName return strings.TrimRight(ps.DNSName, ".")
} }
return fmt.Sprintf("- (%q)", ps.SimpleHostName()) return fmt.Sprintf("(%q)", strings.ReplaceAll(ps.SimpleHostName(), " ", "_"))
} }
func sortKey(ps *ipnstate.PeerStatus) string { func sortKey(ps *ipnstate.PeerStatus) string {