Done templating
This commit is contained in:
35
src/Command/Generate.php
Normal file
35
src/Command/Generate.php
Normal file
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
namespace MenulisAi\Pdfgen\Command;
|
||||
|
||||
use MenulisAi\Pdfgen\Document\Ebook;
|
||||
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 Generate extends Command
|
||||
{
|
||||
protected static $defaultName = "generate";
|
||||
|
||||
protected function configure()
|
||||
{
|
||||
$this->setDescription('Generate a PDF document file from JSON data')
|
||||
->addArgument("input", InputArgument::REQUIRED, "Input path file JSON")
|
||||
->addArgument("output", InputArgument::OPTIONAL, "Set the output path");
|
||||
}
|
||||
|
||||
protected function execute(InputInterface $input, OutputInterface $output): int
|
||||
{
|
||||
$inPath = $input->getArgument("input");
|
||||
|
||||
$output->writeln(rootPath($inPath));
|
||||
|
||||
$doc = new Ebook($inPath);
|
||||
|
||||
$path = $doc->compile();
|
||||
|
||||
// $output->writeln($path);
|
||||
return Command::SUCCESS;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user