Skip to content

Commit 3f89bac

Browse files
authored
Align Show command with Info command from Storm PR
1 parent afd3cb7 commit 3f89bac

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

src/Commands/Show.php

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,17 @@ class Show extends BaseCommand
2424
* @param ShowMode $mode Mode to run the command against
2525
* @param string|null $package Individual package to search
2626
* @param boolean $noDev Exclude dev dependencies from search
27+
* @param boolean $latest Include the latest key (might only be present when returnArray = true)
28+
* @param boolean $returnArray Return the results as an array.
2729
* @return void
2830
*/
2931
final public function __construct(
3032
Composer $composer,
3133
public ShowMode $mode = ShowMode::INSTALLED,
3234
public ?string $package = null,
33-
public bool $noDev = false
35+
public bool $noDev = false,
36+
public bool $latest = false,
37+
public bool $returnArray = false,
3438
) {
3539
parent::__construct($composer);
3640
}
@@ -56,6 +60,11 @@ public function execute()
5660
}
5761

5862
$results = json_decode(implode(PHP_EOL, $output['output']), true);
63+
64+
if ($this->returnArray) {
65+
return $results;
66+
}
67+
5968
$packages = [];
6069

6170
if (is_null($this->package) && $this->mode->isCollectible()) {
@@ -236,6 +245,10 @@ protected function arguments(): array
236245
$arguments['--no-dev'] = true;
237246
}
238247

248+
if ($this->latest) {
249+
$arguments['--latest'] = true;
250+
}
251+
239252
$arguments['--format'] = 'json';
240253

241254
return $arguments;

0 commit comments

Comments
 (0)