refactored alignment of text output
parent
bf0b42efaa
commit
fbbd6f8999
|
@ -48,20 +48,22 @@ EOT
|
||||||
|
|
||||||
$versionParser = new VersionParser;
|
$versionParser = new VersionParser;
|
||||||
|
|
||||||
$nameLength = strlen($root->getPrettyName());
|
|
||||||
$versionLength = strlen($versionParser->formatVersion($root));
|
|
||||||
|
|
||||||
foreach ($repo->getPackages() as $package) {
|
foreach ($repo->getPackages() as $package) {
|
||||||
$packages[$package->getName()] = $package;
|
$packages[$package->getName()] = $package;
|
||||||
|
|
||||||
$nameLength = max($nameLength, strlen($package->getPrettyName()));
|
|
||||||
$versionLength = max($versionLength, strlen($versionParser->formatVersion($package)));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ksort($packages);
|
ksort($packages);
|
||||||
|
|
||||||
switch ($format = $input->getOption('format')) {
|
switch ($format = $input->getOption('format')) {
|
||||||
case 'text':
|
case 'text':
|
||||||
|
$nameLength = strlen($root->getPrettyName());
|
||||||
|
$versionLength = strlen($versionParser->formatVersion($root));
|
||||||
|
|
||||||
|
foreach ($packages as $package) {
|
||||||
|
$nameLength = max($nameLength, strlen($package->getPrettyName()));
|
||||||
|
$versionLength = max($versionLength, strlen($versionParser->formatVersion($package)));
|
||||||
|
}
|
||||||
|
|
||||||
$formatRowCallback = function (PackageInterface $package) use ($versionParser, $nameLength, $versionLength) {
|
$formatRowCallback = function (PackageInterface $package) use ($versionParser, $nameLength, $versionLength) {
|
||||||
return sprintf(
|
return sprintf(
|
||||||
' %s %s %s',
|
' %s %s %s',
|
||||||
|
|
Loading…
Reference in New Issue