1
0
Fork 0

Add links to repo to show/outdated commands package lists, fixes #9367

pull/10430/head
Jordi Boggiano 2022-01-04 17:11:28 +01:00
parent 711f436b24
commit 06bb3c9179
No known key found for this signature in database
GPG Key ID: 7BBD42C429EC80BC
1 changed files with 15 additions and 1 deletions

View File

@ -326,6 +326,7 @@ EOT
} }
// list packages // list packages
/** @var array<string, array<string, string|CompletePackageInterface>> $packages */
$packages = array(); $packages = array();
$packageFilterRegex = null; $packageFilterRegex = null;
if (null !== $packageFilter) { if (null !== $packageFilter) {
@ -437,6 +438,14 @@ EOT
} }
$packageViewData['name'] = $package->getPrettyName(); $packageViewData['name'] = $package->getPrettyName();
if ($format !== 'json' || true !== $input->getOption('name-only')) {
$packageViewData['homepage'] = $package->getHomepage();
if (isset($package->getSupport()['source'])) {
$packageViewData['source'] = $package->getSupport()['source'];
} elseif (null !== $package->getSourceUrl()) {
$packageViewData['source'] = $package->getSourceUrl();
}
}
$nameLength = max($nameLength, strlen($package->getPrettyName())); $nameLength = max($nameLength, strlen($package->getPrettyName()));
if ($writeVersion) { if ($writeVersion) {
$packageViewData['version'] = $package->getFullPrettyVersion(); $packageViewData['version'] = $package->getFullPrettyVersion();
@ -528,7 +537,12 @@ EOT
} }
foreach ($packages as $package) { foreach ($packages as $package) {
$io->write($indent . str_pad($package['name'], $nameLength, ' '), false); $link = $package['source'] ?? $package['homepage'] ?? '';
if ($link) {
$io->write($indent . '<href='.str_replace('>', '', $link).'>'.$package['name'].'</>'. str_repeat(' ', $nameLength - strlen($package['name'])), false);
} else {
$io->write($indent . str_pad($package['name'], $nameLength, ' '), false);
}
if (isset($package['version']) && $writeVersion) { if (isset($package['version']) && $writeVersion) {
$io->write(' ' . str_pad($package['version'], $versionLength, ' '), false); $io->write(' ' . str_pad($package['version'], $versionLength, ' '), false);
} }