Add abandoned flag in search command output
parent
9e762a4f9a
commit
85f3bb070d
|
@ -93,12 +93,13 @@ EOT
|
||||||
$nameLength += 1;
|
$nameLength += 1;
|
||||||
foreach ($results as $result) {
|
foreach ($results as $result) {
|
||||||
$description = isset($result['description']) ? $result['description'] : '';
|
$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) {
|
if (strlen($description) > $remaining) {
|
||||||
$description = substr($description, 0, $remaining - 3) . '...';
|
$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') {
|
} elseif ($format === 'json') {
|
||||||
$io->write(JsonFile::encode($results));
|
$io->write(JsonFile::encode($results));
|
||||||
|
|
Loading…
Reference in New Issue