Fixes --version and --help

This commit is contained in:
Nuno Maduro
2022-09-17 23:47:47 +01:00
parent 08b62f6633
commit 0e0e2adfbe
26 changed files with 511 additions and 86 deletions

View File

@ -5,8 +5,8 @@ declare(strict_types=1);
namespace Pest\Plugins;
use Pest\Contracts\Plugins\HandlesArguments;
use Pest\Support\View;
use function Pest\version;
use Symfony\Component\Console\Output\OutputInterface;
/**
* @internal
@ -15,24 +15,17 @@ final class Version implements HandlesArguments
{
use Concerns\HandleArguments;
/**
* Creates a new Plugin instance.
*/
public function __construct(
private readonly OutputInterface $output
) {
// ..
}
/**
* {@inheritDoc}
*/
public function handleArguments(array $arguments): array
{
if ($this->hasArgument('--version', $arguments)) {
$this->output->writeln(
sprintf('Pest %s', version()),
);
View::render('version', [
'version' => version(),
]);
exit(0);
}
return $arguments;