Skip to content

Commit 6a61c5e

Browse files
dermatzCopilot
andauthored
feat: enhance theme command arguments for better clarity and compatib… (#40)
* feat: enhance theme command arguments for better clarity and compatibility 🎨 * Update src/Console/Command/Theme/BuildCommand.php Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --------- Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
1 parent 5426d18 commit 6a61c5e

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

src/Console/Command/Theme/BuildCommand.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ protected function configure(): void
4545
->addArgument(
4646
'themeCodes',
4747
InputArgument::IS_ARRAY,
48-
'The codes of the theme to build'
48+
'Theme codes to build (format: Vendor/theme, Vendor/theme 2, ...)'
4949
)
5050
->setAliases(['frontend:build']);
5151
}

src/Console/Command/Theme/WatchCommand.php

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
use OpenForgeProject\MageForge\Model\ThemeList;
1010
use OpenForgeProject\MageForge\Model\ThemePath;
1111
use OpenForgeProject\MageForge\Service\ThemeBuilder\BuilderPool;
12+
use Symfony\Component\Console\Input\InputArgument;
1213
use Symfony\Component\Console\Input\InputInterface;
1314
use Symfony\Component\Console\Input\InputOption;
1415
use Symfony\Component\Console\Output\OutputInterface;
@@ -38,6 +39,11 @@ protected function configure()
3839
{
3940
$this->setName($this->getCommandName('theme', 'watch'))
4041
->setDescription('Watches theme files for changes and rebuilds them automatically')
42+
->addArgument(
43+
'themeCode',
44+
InputArgument::OPTIONAL,
45+
'Theme to watch (format: Vendor/theme)'
46+
)
4147
->addOption(
4248
'theme',
4349
't',
@@ -52,7 +58,11 @@ protected function configure()
5258
*/
5359
protected function executeCommand(InputInterface $input, OutputInterface $output): int
5460
{
55-
$themeCode = $input->getOption('theme');
61+
$themeCode = $input->getArgument('themeCode');
62+
63+
if (empty($themeCode)) {
64+
$themeCode = $input->getOption('theme');
65+
}
5666

5767
if (empty($themeCode)) {
5868
$themes = $this->themeList->getAllThemes();

0 commit comments

Comments
 (0)