From 1b78ba0e77e915f210b4d01cd14d53431f652bb6 Mon Sep 17 00:00:00 2001 From: Dane Powell Date: Thu, 21 Nov 2024 15:08:02 -0800 Subject: [PATCH 1/2] CLI-1406: Command documentation markup --- src/Command/Self/MakeDocsCommand.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/Command/Self/MakeDocsCommand.php b/src/Command/Self/MakeDocsCommand.php index b888f642a..ad777cc2e 100644 --- a/src/Command/Self/MakeDocsCommand.php +++ b/src/Command/Self/MakeDocsCommand.php @@ -7,6 +7,7 @@ use Acquia\Cli\Command\CommandBase; use Symfony\Component\Console\Attribute\AsCommand; use Symfony\Component\Console\Command\Command; +use Symfony\Component\Console\Formatter\OutputFormatter; use Symfony\Component\Console\Helper\DescriptorHelper; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Input\InputOption; @@ -19,7 +20,7 @@ final class MakeDocsCommand extends CommandBase protected function configure(): void { $this->addOption('format', 'f', InputOption::VALUE_OPTIONAL, 'The format to describe the docs in.', 'rst'); - $this->addOption('dump', 'd', InputOption::VALUE_OPTIONAL, 'Dump docs to directory'); + $this->addOption('dump', 'd', InputOption::VALUE_OPTIONAL, 'Dump docs to directory (implies JSON format)'); } protected function execute(InputInterface $input, OutputInterface $output): int @@ -46,6 +47,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int continue; } $filename = $command['name'] . '.json'; + $command['help'] = (new OutputFormatter())->format($command['help']); $index[] = [ 'command' => $command['name'], 'help' => $command['help'], From 2f6a179e8129cd171cd1ca542d05b9faa5fa22d8 Mon Sep 17 00:00:00 2001 From: Dane Powell Date: Thu, 21 Nov 2024 16:04:42 -0800 Subject: [PATCH 2/2] kill mutant --- tests/phpunit/src/Commands/Self/MakeDocsCommandTest.php | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/tests/phpunit/src/Commands/Self/MakeDocsCommandTest.php b/tests/phpunit/src/Commands/Self/MakeDocsCommandTest.php index 6ae7a534b..1ae603ef9 100644 --- a/tests/phpunit/src/Commands/Self/MakeDocsCommandTest.php +++ b/tests/phpunit/src/Commands/Self/MakeDocsCommandTest.php @@ -7,6 +7,7 @@ use Acquia\Cli\Command\CommandBase; use Acquia\Cli\Command\Self\MakeDocsCommand; use Acquia\Cli\Tests\CommandTestBase; +use org\bovigo\vfs\vfsStream; /** * @property \Acquia\Cli\Command\Self\MakeDocsCommand $command @@ -26,4 +27,11 @@ public function testMakeDocsCommand(): void $this->assertStringContainsString('============', $output); $this->assertStringContainsString('- `help`_', $output); } + + public function testMakeDocsCommandDump(): void + { + $vfs = vfsStream::setup('root'); + $this->executeCommand(['--dump' => $vfs->url()]); + $this->assertStringContainsString('The completion command dumps', $vfs->getChild('completion.json')->getContent()); + } }