Fix show command output to remove v prefixes on versions, making for more uniform output, fixes #11925
parent
89f057e0df
commit
92f641ac3d
|
@ -535,10 +535,13 @@ EOT
|
|||
$packageViewData['homepage'] = $package instanceof CompletePackageInterface ? $package->getHomepage() : null;
|
||||
$packageViewData['source'] = PackageInfo::getViewSourceUrl($package);
|
||||
}
|
||||
$nameLength = max($nameLength, strlen($package->getPrettyName()));
|
||||
$nameLength = max($nameLength, strlen($packageViewData['name']));
|
||||
if ($writeVersion) {
|
||||
$packageViewData['version'] = $package->getFullPrettyVersion();
|
||||
$versionLength = max($versionLength, strlen($package->getFullPrettyVersion()));
|
||||
if ($format === 'text') {
|
||||
$packageViewData['version'] = ltrim($packageViewData['version'], 'v');
|
||||
}
|
||||
$versionLength = max($versionLength, strlen($packageViewData['version']));
|
||||
}
|
||||
if ($writeReleaseDate) {
|
||||
if ($package->getReleaseDate() !== null) {
|
||||
|
@ -553,6 +556,9 @@ EOT
|
|||
}
|
||||
if ($writeLatest && $latestPackage) {
|
||||
$packageViewData['latest'] = $latestPackage->getFullPrettyVersion();
|
||||
if ($format === 'text') {
|
||||
$packageViewData['latest'] = ltrim($packageViewData['latest'], 'v');
|
||||
}
|
||||
$packageViewData['latest-status'] = $this->getUpdateStatus($latestPackage, $package);
|
||||
$latestLength = max($latestLength, strlen($packageViewData['latest']));
|
||||
} elseif ($writeLatest) {
|
||||
|
|
|
@ -36,13 +36,13 @@ class ShowCommandTest extends TestCase
|
|||
'packages' => [
|
||||
'type' => 'package',
|
||||
'package' => [
|
||||
['name' => 'vendor/package', 'description' => 'generic description', 'version' => '1.0.0'],
|
||||
['name' => 'vendor/package', 'description' => 'generic description', 'version' => 'v1.0.0'],
|
||||
|
||||
['name' => 'outdated/major', 'description' => 'outdated/major v1.0.0 description', 'version' => '1.0.0'],
|
||||
['name' => 'outdated/major', 'description' => 'outdated/major v1.0.1 description', 'version' => '1.0.1'],
|
||||
['name' => 'outdated/major', 'description' => 'outdated/major v1.1.0 description', 'version' => '1.1.0'],
|
||||
['name' => 'outdated/major', 'description' => 'outdated/major v1.1.1 description', 'version' => '1.1.1'],
|
||||
['name' => 'outdated/major', 'description' => 'outdated/major v2.0.0 description', 'version' => '2.0.0'],
|
||||
['name' => 'outdated/major', 'description' => 'outdated/major v1.0.0 description', 'version' => 'v1.0.0'],
|
||||
['name' => 'outdated/major', 'description' => 'outdated/major v1.0.1 description', 'version' => 'v1.0.1'],
|
||||
['name' => 'outdated/major', 'description' => 'outdated/major v1.1.0 description', 'version' => 'v1.1.0'],
|
||||
['name' => 'outdated/major', 'description' => 'outdated/major v1.1.1 description', 'version' => 'v1.1.1'],
|
||||
['name' => 'outdated/major', 'description' => 'outdated/major v2.0.0 description', 'version' => 'v2.0.0'],
|
||||
|
||||
['name' => 'outdated/minor', 'description' => 'outdated/minor v1.0.0 description', 'version' => '1.0.0'],
|
||||
['name' => 'outdated/minor', 'description' => 'outdated/minor v1.0.1 description', 'version' => '1.0.1'],
|
||||
|
@ -57,9 +57,9 @@ class ShowCommandTest extends TestCase
|
|||
'require' => $requires === [] ? new \stdClass : $requires,
|
||||
]);
|
||||
|
||||
$pkg = self::getPackage('vendor/package', '1.0.0');
|
||||
$pkg = self::getPackage('vendor/package', 'v1.0.0');
|
||||
$pkg->setDescription('description of installed package');
|
||||
$major = self::getPackage('outdated/major', '1.0.0');
|
||||
$major = self::getPackage('outdated/major', 'v1.0.0');
|
||||
$major->setReleaseDate(new DateTimeImmutable());
|
||||
$minor = self::getPackage('outdated/minor', '1.0.0');
|
||||
$minor->setReleaseDate(new DateTimeImmutable('-2 years'));
|
||||
|
|
Loading…
Reference in New Issue