Add basic framework
This commit is contained in:
29
src/Puzzle.php
Normal file
29
src/Puzzle.php
Normal file
@ -0,0 +1,29 @@
|
||||
<?php
|
||||
|
||||
namespace AdventOfCode21;
|
||||
|
||||
use AdventOfCode21\Utils\SymfonyConsoleMarkdown;
|
||||
use Symfony\Component\Console\Command\Command;
|
||||
use Symfony\Component\Console\Input\InputArgument;
|
||||
use Symfony\Component\Console\Input\InputInterface;
|
||||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
|
||||
class Puzzle extends Command
|
||||
{
|
||||
protected function configure(): void
|
||||
{
|
||||
$this
|
||||
->setName('puzzle')
|
||||
->addArgument('day', InputArgument::REQUIRED, 'The day number.');
|
||||
}
|
||||
|
||||
protected function execute(InputInterface $input, OutputInterface $output): int
|
||||
{
|
||||
$contents = file_get_contents(sprintf('%s/../data/day%s/puzzle.md', __DIR__, (int) $input->getArgument('day')));
|
||||
$rendered = (new SymfonyConsoleMarkdown())->render($contents);
|
||||
|
||||
$output->writeln($rendered);
|
||||
|
||||
return Command::SUCCESS;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user