Skip to content

Commit

Permalink
chore: updates ellipsis
Browse files Browse the repository at this point in the history
  • Loading branch information
nunomaduro committed Nov 6, 2023
1 parent e238c00 commit c919c31
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/Printers/Detail.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
use Pest\Stressless\Result;

use function Termwind\render;
use function Termwind\terminal;

/**
* @internal
Expand Down Expand Up @@ -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', <<<HTML
<span class="text-gray mr-1">$dnsRecords</span>
<span class="$color">$value</span>
Expand Down

0 comments on commit c919c31

Please sign in to comment.