Use annotations and autoconfiguration

Use the `AsCommand` annotation to automatically register commands as
services and automatically add them to `./bin/console` instead of adding
them manually.
This commit is contained in:
Oliver Davies 2024-02-26 20:40:58 +00:00
parent bfc9a89842
commit 4ebfd9333a
17 changed files with 78 additions and 81 deletions

View file

@ -7,15 +7,18 @@ use App\Action\DetermineProjectLanguage;
use App\Enum\PackageManager;
use App\Enum\ProjectLanguage;
use App\Process\Process;
use Symfony\Component\Console\Attribute\AsCommand;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
#[AsCommand(
description: 'Install a new package',
name: 'package-install',
)]
final class PackageInstallCommand extends AbstractCommand
{
public static string $description = 'Install a new package';
public function configure(): void
{
parent::configure();