Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions Commands/GenerateAnnotations.php
Original file line number Diff line number Diff line change
Expand Up @@ -77,15 +77,18 @@ protected function doExecute(): int
return self::FAILURE;
}

$plugin = $input->getOption('plugin') ?: 'Matomo';
$plugin = $input->getOption('plugin');
if (empty($plugin)) {
throw new \RuntimeException('Please specify a plugin name.');
}
$notDryRun = $input->getOption('not-dry-run') ?: false;

$output->writeln(sprintf('<info>Generating annotations for: %s</info>', $plugin));

$result = (StaticContainer::get(AnnotationGenerator::class))->generatePluginApiAnnotations($plugin, $notDryRun);

if ($notDryRun) {
$output->writeln('<info>Results written to ' . $plugin . ' plugin\'s /OpenApi/Annotations directory.</info>');
$output->writeln('<info>Results written to plugins/OpenApiDocs/tmp/annotations/ directory.</info>');

return $result ? self::SUCCESS : self::FAILURE;
}
Expand Down
7 changes: 5 additions & 2 deletions Commands/GenerateSpecFile.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,10 @@ protected function doExecute(): int
$input = $this->getInput();
$output = $this->getOutput();

$plugin = $input->getOption('plugin') ?: 'Matomo';
$plugin = $input->getOption('plugin');
if (empty($plugin)) {
throw new \RuntimeException('Please specify a plugin name.');
}
$format = $input->getOption('format') ?: 'json';
$version = $input->getOption('version') ?: '1.0.0';
$notDryRun = $input->getOption('not-dry-run') ?: false;
Expand All @@ -85,7 +88,7 @@ protected function doExecute(): int
$result = (new SpecGenerator())->generatePluginDoc($plugin, $format, $version, $notDryRun);

if ($notDryRun) {
$output->writeln('<info>Results written to ' . $plugin . ' plugin\'s /OpenApi/Specs directory.</info>');
$output->writeln('<info>Results written to plugins/OpenApiDocs/tmp/specs/ directory.</info>');

return $result ? self::SUCCESS : self::FAILURE;
}
Expand Down