From c919c31213161fd643c020c35e3cba990e1407c8 Mon Sep 17 00:00:00 2001 From: Nuno Maduro Date: Mon, 6 Nov 2023 17:34:16 +0000 Subject: [PATCH] chore: updates ellipsis --- src/Printers/Detail.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/Printers/Detail.php b/src/Printers/Detail.php index 257ee77..20c5e33 100644 --- a/src/Printers/Detail.php +++ b/src/Printers/Detail.php @@ -7,6 +7,7 @@ use Pest\Stressless\Result; use function Termwind\render; +use function Termwind\terminal; /** * @internal @@ -36,13 +37,12 @@ public function print(Result $result): void $dnsRecords = dns_get_record($domain, DNS_AAAA + DNS_A); $dnsRecords = array_map(fn (array $record): string => $record['ipv6'] ?? $record['ip'], $dnsRecords ?: []); $dnsRecords = array_unique($dnsRecords); - if (count($dnsRecords) > 3) { - $dnsRecords = array_slice($dnsRecords, 0, 3); - $dnsRecords[] = '(…)'; - } - $dnsRecords = implode(', ', $dnsRecords); + if (strlen($dnsRecords) > ($size = terminal()->width() - 100)) { + $dnsRecords = substr($dnsRecords, 0, $size).'(…)'; + } + $this->twoColumnDetail('DNS Lookup Duration', <<$dnsRecords $value