setName('make:index')
->setDescription('Générer l’index des différentes documentations')
->setHelp('L’index se crée à partir des différents fichiers autodoc.json des documentations générées')
->addOption('outputs', 'o', InputOption::VALUE_OPTIONAL, 'Répertoire stockant toutes les documentations générées. Chemin absolu ou relatif au répertoire courant. Défaut : "var/output"')
->addOption('topnav', null, InputOption::VALUE_OPTIONAL, 'URL d’un fichier JS à charger dans le head html. Exemple : "//boussole.spip.net/?page=spipnav.js&lang=fr"')
->addOption('topnav_spip', null, InputOption::VALUE_NONE, 'Intègre le JS de la boussole SPIP en entête topnav.');
}
protected function execute(InputInterface $input, OutputInterface $output)
{
$context = new Context($input, $output);
/** @var SymfonyStyle */
$io = $context->get('io');
$io->title("Autodoc " . $this->getName());
if ($input->getOption('outputs')) {
$context->directory->set('output_base', $input->getOption('outputs'));
}
$context->set('topnav', $input->getOption('topnav'));
$context->set('topnav_spip', $input->getOption('topnav_spip'));
$this->pipeline($context);
return Command::SUCCESS;
}
protected function pipeline(Context $context): void
{
$processor = new InterruptibleProcessor(fn (Context $context) => $context->empty('errors'));
$pipeline = (new Pipeline($processor))
->pipe(new IndexStage());
$pipeline->process($context);
}
}