Skip to content

Commit d351900

Browse files
authored
Merge pull request #12 from matomo-org/quick-adjustment
Quick adjustments to the generator commands
2 parents fe9b540 + 2a4b3ba commit d351900

2 files changed

Lines changed: 10 additions & 4 deletions

File tree

Commands/GenerateAnnotations.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,15 +77,18 @@ protected function doExecute(): int
7777
return self::FAILURE;
7878
}
7979

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

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

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

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

9093
return $result ? self::SUCCESS : self::FAILURE;
9194
}

Commands/GenerateSpecFile.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,10 @@ protected function doExecute(): int
7373
$input = $this->getInput();
7474
$output = $this->getOutput();
7575

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

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

9093
return $result ? self::SUCCESS : self::FAILURE;
9194
}

0 commit comments

Comments
 (0)