From afd3cb760241ad080c84ecf3d5d7b169eaf9b626 Mon Sep 17 00:00:00 2001 From: Luke Towers Date: Wed, 6 Aug 2025 15:05:53 -0600 Subject: [PATCH 1/3] Include arguments provided in the result returned by runComposerCommand() --- src/Commands/BaseCommand.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/Commands/BaseCommand.php b/src/Commands/BaseCommand.php index 8ed8494..2faafc5 100644 --- a/src/Commands/BaseCommand.php +++ b/src/Commands/BaseCommand.php @@ -168,12 +168,14 @@ protected function runComposerCommand(): array $return = [ 'code' => $code, 'output' => preg_split('/(\n|\r\n)/', trim($output->fetch())), + 'arguments' => $arguments, ]; } catch (\Exception $e) { $return = [ 'code' => 1, 'output' => preg_split('/(\n|\r\n)/', $e->getMessage()), 'exception' => $e, + 'arguments' => $arguments, ]; } From 3f89bacf2d6754615e34cc67eb06894df8cf661c Mon Sep 17 00:00:00 2001 From: Luke Towers Date: Wed, 6 Aug 2025 15:26:46 -0600 Subject: [PATCH 2/3] Align Show command with Info command from Storm PR --- src/Commands/Show.php | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/src/Commands/Show.php b/src/Commands/Show.php index 562a983..1b0a0ff 100644 --- a/src/Commands/Show.php +++ b/src/Commands/Show.php @@ -24,13 +24,17 @@ class Show extends BaseCommand * @param ShowMode $mode Mode to run the command against * @param string|null $package Individual package to search * @param boolean $noDev Exclude dev dependencies from search + * @param boolean $latest Include the latest key (might only be present when returnArray = true) + * @param boolean $returnArray Return the results as an array. * @return void */ final public function __construct( Composer $composer, public ShowMode $mode = ShowMode::INSTALLED, public ?string $package = null, - public bool $noDev = false + public bool $noDev = false, + public bool $latest = false, + public bool $returnArray = false, ) { parent::__construct($composer); } @@ -56,6 +60,11 @@ public function execute() } $results = json_decode(implode(PHP_EOL, $output['output']), true); + + if ($this->returnArray) { + return $results; + } + $packages = []; if (is_null($this->package) && $this->mode->isCollectible()) { @@ -236,6 +245,10 @@ protected function arguments(): array $arguments['--no-dev'] = true; } + if ($this->latest) { + $arguments['--latest'] = true; + } + $arguments['--format'] = 'json'; return $arguments; From 1718536b55a62dc5e269630c1deceb1ec737546d Mon Sep 17 00:00:00 2001 From: Luke Towers Date: Wed, 6 Aug 2025 16:12:08 -0600 Subject: [PATCH 3/3] Update Show.php --- src/Commands/Show.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/Commands/Show.php b/src/Commands/Show.php index 1b0a0ff..8c3c664 100644 --- a/src/Commands/Show.php +++ b/src/Commands/Show.php @@ -62,7 +62,9 @@ public function execute() $results = json_decode(implode(PHP_EOL, $output['output']), true); if ($this->returnArray) { - return $results; + return $this->package + ? $results ?? [] + : $results['installed'] ?? []; } $packages = [];