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['homepage'] = $package instanceof CompletePackageInterface ? $package->getHomepage() : null;
|
||||||
$packageViewData['source'] = PackageInfo::getViewSourceUrl($package);
|
$packageViewData['source'] = PackageInfo::getViewSourceUrl($package);
|
||||||
}
|
}
|
||||||
$nameLength = max($nameLength, strlen($package->getPrettyName()));
|
$nameLength = max($nameLength, strlen($packageViewData['name']));
|
||||||
if ($writeVersion) {
|
if ($writeVersion) {
|
||||||
$packageViewData['version'] = $package->getFullPrettyVersion();
|
$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 ($writeReleaseDate) {
|
||||||
if ($package->getReleaseDate() !== null) {
|
if ($package->getReleaseDate() !== null) {
|
||||||
|
@ -553,6 +556,9 @@ EOT
|
||||||
}
|
}
|
||||||
if ($writeLatest && $latestPackage) {
|
if ($writeLatest && $latestPackage) {
|
||||||
$packageViewData['latest'] = $latestPackage->getFullPrettyVersion();
|
$packageViewData['latest'] = $latestPackage->getFullPrettyVersion();
|
||||||
|
if ($format === 'text') {
|
||||||
|
$packageViewData['latest'] = ltrim($packageViewData['latest'], 'v');
|
||||||
|
}
|
||||||
$packageViewData['latest-status'] = $this->getUpdateStatus($latestPackage, $package);
|
$packageViewData['latest-status'] = $this->getUpdateStatus($latestPackage, $package);
|
||||||
$latestLength = max($latestLength, strlen($packageViewData['latest']));
|
$latestLength = max($latestLength, strlen($packageViewData['latest']));
|
||||||
} elseif ($writeLatest) {
|
} elseif ($writeLatest) {
|
||||||
|
|
|
@ -36,13 +36,13 @@ class ShowCommandTest extends TestCase
|
||||||
'packages' => [
|
'packages' => [
|
||||||
'type' => 'package',
|
'type' => 'package',
|
||||||
'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.0 description', 'version' => 'v1.0.0'],
|
||||||
['name' => 'outdated/major', 'description' => 'outdated/major v1.0.1 description', 'version' => '1.0.1'],
|
['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' => '1.1.0'],
|
['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' => '1.1.1'],
|
['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' => '2.0.0'],
|
['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.0 description', 'version' => '1.0.0'],
|
||||||
['name' => 'outdated/minor', 'description' => 'outdated/minor v1.0.1 description', 'version' => '1.0.1'],
|
['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,
|
'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');
|
$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());
|
$major->setReleaseDate(new DateTimeImmutable());
|
||||||
$minor = self::getPackage('outdated/minor', '1.0.0');
|
$minor = self::getPackage('outdated/minor', '1.0.0');
|
||||||
$minor->setReleaseDate(new DateTimeImmutable('-2 years'));
|
$minor->setReleaseDate(new DateTimeImmutable('-2 years'));
|
||||||
|
|
Loading…
Reference in New Issue