Create AbstractSpinnerCommand and BuildCommand

This commit is contained in:
Daniel Winning 2025-04-08 23:00:21 +01:00
parent 3e6c4b9bab
commit 0afce1ab9e
5 changed files with 71 additions and 3 deletions

3
README.md Normal file
View file

@ -0,0 +1,3 @@
# Loom | Spinner
An environment management application for PHP development.

View file

@ -1,4 +1,17 @@
#!/usr/bin/env php
<?php
require dirname(__DIR__) . '/vendor/autoload.php';
use Loom\Spinner\Command\SpinCommand;
use Symfony\Component\Console\Application;
require dirname(__DIR__) . '/vendor/autoload.php';
$application = new Application('Loom Spinner');
$application->add(new SpinCommand());
try {
$application->run();
} catch (\Exception $exception) {
die();
}

View file

@ -2,7 +2,18 @@
"name": "loomlabs/spinner",
"autoload": {
"psr-4": {
"Spinner\\": "src/"
"Loom\\Spinner\\": "src/"
}
},
"autoload-dev": {
"psr-4": {
"Loom\\Spinner\\Tests\\": "tests/"
}
},
"require": {
"symfony/console": "^7.2"
},
"require-dev": {
"phpunit/phpunit": "^12.1"
}
}
}

View file

@ -0,0 +1,20 @@
<?php
declare(strict_types=1);
namespace Loom\Spinner\Command;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Style\SymfonyStyle;
class AbstractSpinnerCommand extends Command
{
protected SymfonyStyle $style;
protected function setStyle(InputInterface $input, OutputInterface $output): void
{
$this->style = new SymfonyStyle($input, $output);
}
}

View file

@ -0,0 +1,21 @@
<?php
declare(strict_types=1);
namespace Loom\Spinner\Command;
use Symfony\Component\Console\Attribute\AsCommand;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
#[AsCommand(name: 'spin', description: 'Spin up a new development environment')]
class SpinCommand extends AbstractSpinnerCommand
{
protected function execute(InputInterface $input, OutputInterface $output): int
{
$this->setStyle($input, $output);
return Command::SUCCESS;
}
}