1
0
Fork 0

Merge remote-tracking branch 'weaverryan/search-formatting'

pull/661/head
Jordi Boggiano 2012-05-12 09:46:49 +02:00
commit 1495f9dfe0
1 changed files with 8 additions and 2 deletions

View File

@ -62,6 +62,7 @@ EOT
$tokens = $input->getArgument('tokens');
$packages = array();
$maxPackageLength = 0;
foreach ($repos->getPackages() as $package) {
if ($package instanceof AliasPackage || isset($packages[$package->getName()])) {
continue;
@ -82,14 +83,19 @@ EOT
$packages[$package->getName()] = array(
'name' => $name,
'description' => strtok($package->getDescription(), "\r\n")
'description' => strtok($package->getDescription(), "\r\n"),
'length' => strlen($package->getPrettyName())
);
$maxPackageLength = max($maxPackageLength, strlen($package->getPrettyName()));
continue 2;
}
}
foreach ($packages as $details) {
$output->writeln($details['name'] .' <comment>:</comment> '. $details['description']);
$extraSpaces = $maxPackageLength - $details['length'];
$output->writeln($details['name'] . str_repeat(' ', $extraSpaces) .' <comment>:</comment> '. $details['description']);
}
}