diff --git a/CHANGELOG.md b/CHANGELOG.md index 799ec9b..8f667ab 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -19,6 +19,7 @@ All notable changes to this project will be documented in this file. - changed Repository URLs - added codacy code-quality badge to `README.md` - moved to OpenForgeProject +- add ListThemesCommand --- diff --git a/src/Console/Command/ListThemesCommand.php b/src/Console/Command/ListThemesCommand.php new file mode 100644 index 0000000..e01e6ad --- /dev/null +++ b/src/Console/Command/ListThemesCommand.php @@ -0,0 +1,66 @@ +setName('mageforge:themes:list'); + $this->setDescription('Lists all available themes'); + } + + /** + * Execute the command + * + * @param InputInterface $input + * @param OutputInterface $output + * @return int + */ + protected function execute( + InputInterface $input, + OutputInterface $output, + ): int { + $themes = $this->themeList->getAllThemes(); + + if (empty($themes)) { + $output->writeln('No themes found.'); + return Cli::RETURN_SUCCESS; + } + + $output->writeln('Available Themes:'); + foreach ($themes as $path => $theme) { + $output->writeln( + sprintf( + '%s - %s', + $path, + $theme->getThemeTitle(), + ), + ); + } + + return Cli::RETURN_SUCCESS; + } +} diff --git a/src/Model/ThemeList.php b/src/Model/ThemeList.php new file mode 100644 index 0000000..dd25e4c --- /dev/null +++ b/src/Model/ThemeList.php @@ -0,0 +1,30 @@ +magentoThemeList->getItems(); + } +} diff --git a/src/etc/di.xml b/src/etc/di.xml index 95d22e9..342417f 100644 --- a/src/etc/di.xml +++ b/src/etc/di.xml @@ -21,6 +21,10 @@ name="openforgeproject_mageforge_system_check" xsi:type="object" >OpenForgeProject\MageForge\Console\Command\SystemCheckCommand + OpenForgeProject\MageForge\Console\Command\ListThemesCommand