Skip to content
Snippets Groups Projects
Verified Commit 3238f4d7 authored by Jiří Pudil's avatar Jiří Pudil
Browse files

chore: replace defaultName with attribute in console commands

parent 959a4ad2
Branches master
Tags 0.6.9
No related merge requests found
Pipeline #59802 failed
......@@ -7,20 +7,17 @@ namespace Grifart\ClassScaffolder\Console;
use Grifart\ClassScaffolder\Definition\ClassDefinition;
use Grifart\ClassScaffolder\DefinitionFile;
use Grifart\ClassScaffolder\DefinitionResult;
use Symfony\Component\Console\Attribute\AsCommand;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
#[AsCommand(
name: 'check',
description: 'Checks that all generated classes match given definitions.',
aliases: ['grifart:scaffolder:check'],
)]
final class CheckCommand extends ScaffolderCommand
{
protected function configure(): void
{
parent::configure();
$this->setName('check')
->setDescription('Checks that all generated classes match given definitions.')
->setAliases(['grifart:scaffolder:check']);
}
protected function execute(InputInterface $input, OutputInterface $output): int
{
try {
......
......@@ -8,20 +8,22 @@ use Grifart\ClassScaffolder\Definition\ClassDefinition;
use Grifart\ClassScaffolder\DefinitionFile;
use Grifart\ClassScaffolder\DefinitionResult;
use Grifart\ClassScaffolder\FileResult;
use Symfony\Component\Console\Attribute\AsCommand;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;
#[AsCommand(
name: 'scaffold',
description: 'Generate classes from given definitions.',
aliases: ['grifart:scaffolder:scaffold', 'grifart:scaffolder:generateClass'],
)]
final class ScaffoldCommand extends ScaffolderCommand
{
protected function configure(): void
{
parent::configure();
$this->setName('scaffold')
->setDescription('Generate classes from given definitions.')
->addOption('no-readonly', NULL, InputOption::VALUE_NONE, 'Generated files are marked as read only by default (using chmod). Use this option to turn off this behaviour.')
->setAliases(['grifart:scaffolder:scaffold', 'grifart:scaffolder:generateClass']);
$this->addOption('no-readonly', NULL, InputOption::VALUE_NONE, 'Generated files are marked as read only by default (using chmod). Use this option to turn off this behaviour.');
}
protected function execute(InputInterface $input, OutputInterface $output): int
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment