1
0
Fork 0

Add abandoned flag in search command output

pull/10218/head^2
Jordi Boggiano 2021-11-09 16:04:21 +01:00
parent 9e762a4f9a
commit 85f3bb070d
No known key found for this signature in database
GPG Key ID: 7BBD42C429EC80BC
1 changed files with 3 additions and 2 deletions

View File

@ -93,12 +93,13 @@ EOT
$nameLength += 1;
foreach ($results as $result) {
$description = isset($result['description']) ? $result['description'] : '';
$remaining = $width - $nameLength - 2;
$warning = !empty($result['abandoned']) ? '<warning>! Abandoned !</warning> ' : '';
$remaining = $width - $nameLength - strlen($warning) - 2;
if (strlen($description) > $remaining) {
$description = substr($description, 0, $remaining - 3) . '...';
}
$io->write(str_pad($result['name'], $nameLength, ' ') . $description);
$io->write(str_pad($result['name'], $nameLength, ' ') . $warning . $description);
}
} elseif ($format === 'json') {
$io->write(JsonFile::encode($results));