From 2a4b3ba97e0776f8eaa3588978703e3e31b5cde1 Mon Sep 17 00:00:00 2001 From: Jacob Ransom Date: Mon, 29 Sep 2025 15:34:00 +1300 Subject: [PATCH] Quick adjustments to the generator commands --- Commands/GenerateAnnotations.php | 7 +++++-- Commands/GenerateSpecFile.php | 7 +++++-- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/Commands/GenerateAnnotations.php b/Commands/GenerateAnnotations.php index a600781..1c147df 100644 --- a/Commands/GenerateAnnotations.php +++ b/Commands/GenerateAnnotations.php @@ -77,7 +77,10 @@ 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('Generating annotations for: %s', $plugin)); @@ -85,7 +88,7 @@ protected function doExecute(): int $result = (StaticContainer::get(AnnotationGenerator::class))->generatePluginApiAnnotations($plugin, $notDryRun); if ($notDryRun) { - $output->writeln('Results written to ' . $plugin . ' plugin\'s /OpenApi/Annotations directory.'); + $output->writeln('Results written to plugins/OpenApiDocs/tmp/annotations/ directory.'); return $result ? self::SUCCESS : self::FAILURE; } diff --git a/Commands/GenerateSpecFile.php b/Commands/GenerateSpecFile.php index 279a82c..f24aac4 100644 --- a/Commands/GenerateSpecFile.php +++ b/Commands/GenerateSpecFile.php @@ -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; @@ -85,7 +88,7 @@ protected function doExecute(): int $result = (new SpecGenerator())->generatePluginDoc($plugin, $format, $version, $notDryRun); if ($notDryRun) { - $output->writeln('Results written to ' . $plugin . ' plugin\'s /OpenApi/Specs directory.'); + $output->writeln('Results written to plugins/OpenApiDocs/tmp/specs/ directory.'); return $result ? self::SUCCESS : self::FAILURE; }