diff --git a/CHANGELOG.md b/CHANGELOG.md index 3408159..8f65f46 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,7 +2,7 @@ ## 1.0.2 under development -- no changes in this release. +- Chg: #21: Add passing input aggregate to the console application (@xepozz) ## 1.0.1 June 17, 2022 diff --git a/src/ConsoleApplicationRunner.php b/src/ConsoleApplicationRunner.php index bb5aadf..d0df99f 100644 --- a/src/ConsoleApplicationRunner.php +++ b/src/ConsoleApplicationRunner.php @@ -8,6 +8,7 @@ use Exception; use Psr\Container\ContainerExceptionInterface; use Psr\Container\NotFoundExceptionInterface; +use Symfony\Component\Console\Input\ArgvInput; use Throwable; use Yiisoft\Definitions\Exception\CircularReferenceException; use Yiisoft\Definitions\Exception\InvalidConfigException; @@ -53,11 +54,14 @@ public function run(): void $application = $container->get(Application::class); $exitCode = ExitCode::UNSPECIFIED_ERROR; + $input = new ArgvInput(); + $output = new ConsoleBufferedOutput(); + try { - $application->start(); - $exitCode = $application->run(null, new ConsoleBufferedOutput()); + $application->start($input); + $exitCode = $application->run($input, $output); } catch (Throwable $throwable) { - $application->renderThrowable($throwable, new ConsoleBufferedOutput()); + $application->renderThrowable($throwable, $output); } finally { $application->shutdown($exitCode); exit($exitCode);