diff --git a/src/Command/CreateIconsCommand.php b/src/Command/CreateIconsCommand.php index 204867f..e494393 100644 --- a/src/Command/CreateIconsCommand.php +++ b/src/Command/CreateIconsCommand.php @@ -136,7 +136,9 @@ protected function execute(InputInterface $input, OutputInterface $output): int $io->success('Icons have been generated. You can now use them in your application configuration file.'); $io->writeln(Yaml::dump([ - 'icons' => $generatedIcons, + 'yaml' => [ + 'icons' => $generatedIcons, + ], ], 10, 2)); return self::SUCCESS; diff --git a/src/Command/CreateScreenshotCommand.php b/src/Command/CreateScreenshotCommand.php index a390316..664eacd 100644 --- a/src/Command/CreateScreenshotCommand.php +++ b/src/Command/CreateScreenshotCommand.php @@ -59,19 +59,14 @@ protected function configure(): void null, ['https://example.com', 'https://example.com/feature1'] ); - $this->addArgument( + $this->addOption( 'output', - InputArgument::OPTIONAL, - 'The output directory of the screenshot', - sprintf('%s/assets/screenshots/', $this->projectDir) - ); - $this->addArgument( - 'filename', - InputArgument::OPTIONAL, - 'The output name of the screenshot', - 'screenshot', - ['homepage-android', 'feature1'] + 'o', + InputOption::VALUE_OPTIONAL, + 'The output directory', + sprintf('%s/assets/icons/', $this->projectDir) ); + $this->addOption('filename', null, InputOption::VALUE_OPTIONAL, 'The output filename', 'screenshot'); $this->addOption('width', null, InputOption::VALUE_OPTIONAL, 'The width of the screenshot'); $this->addOption('height', null, InputOption::VALUE_OPTIONAL, 'The height of the screenshot'); $this->addOption( @@ -94,7 +89,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int } $url = $input->getArgument('url'); - $dest = rtrim((string) $input->getArgument('output'), '/'); + $dest = rtrim((string) $input->getOption('output'), '/'); $height = $input->getOption('height'); $width = $input->getOption('width'); $format = $input->getOption('format'); @@ -134,7 +129,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int } $format = current($extensions); - $filename = sprintf('%s/%s%s.%s', $dest, $input->getArgument('filename'), $sizes, $format); + $filename = sprintf('%s/%s%s.%s', $dest, $input->getOption('filename'), $sizes, $format); $this->filesystem->copy($tmpName, $filename, true); $this->filesystem->remove($tmpName); @@ -151,7 +146,9 @@ protected function execute(InputInterface $input, OutputInterface $output): int } $io->success('Screenshot saved. You can now use it in your application configuration file.'); $io->writeln(Yaml::dump([ - 'screenshots' => [$config], + 'pwa' => [ + 'screenshots' => [$config], + ], ], 10, 2)); return self::SUCCESS; diff --git a/tests/Functional/TakeScreenshotCommandTest.php b/tests/Functional/TakeScreenshotCommandTest.php index 5655e42..d054764 100644 --- a/tests/Functional/TakeScreenshotCommandTest.php +++ b/tests/Functional/TakeScreenshotCommandTest.php @@ -23,8 +23,8 @@ public static function aScreenshotIsCorrectlyTake(): void // When $commandTester->execute([ 'url' => 'https://symfony.com', - 'output' => $output, - 'filename' => 'screenshot', + '--output' => $output, + '--filename' => 'screenshot', '--width' => '1024', '--height' => '1920', ]);