Skip to content

Commit

Permalink
Fix command outputs
Browse files Browse the repository at this point in the history
  • Loading branch information
Spomky committed Feb 9, 2024
1 parent 4a80972 commit ad4eee1
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 17 deletions.
4 changes: 3 additions & 1 deletion src/Command/CreateIconsCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
25 changes: 11 additions & 14 deletions src/Command/CreateScreenshotCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand All @@ -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');
Expand Down Expand Up @@ -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);
Expand All @@ -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;
Expand Down
4 changes: 2 additions & 2 deletions tests/Functional/TakeScreenshotCommandTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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',
]);
Expand Down

0 comments on commit ad4eee1

Please sign in to comment.