From d09494ff0276dfb1c65556335b3f359de1be0f19 Mon Sep 17 00:00:00 2001 From: Arnaud Ligny Date: Tue, 11 Feb 2025 11:56:04 +0100 Subject: [PATCH 1/2] feat: autocomplete? --- src/Application.php | 7 +++++-- src/Command/UtilTranslationsExtract.php | 6 ++++++ 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/src/Application.php b/src/Application.php index 1c8f355f6..511a8072e 100644 --- a/src/Application.php +++ b/src/Application.php @@ -41,8 +41,10 @@ public function getHelp(): string */ protected function getDefaultCommands(): array { - $commands = [ + //$commands = [ + $commands = array_merge(parent::getDefaultCommands(), [ new \Symfony\Component\Console\Command\HelpCommand(), + new \Symfony\Component\Console\Command\CompleteCommand(), new Command\NewSite(), new Command\NewPage(), new Command\OpenWith(), @@ -57,7 +59,8 @@ protected function getDefaultCommands(): array new Command\ShowConfig(), new Command\ListCommand(), new Command\UtilTranslationsExtract() - ]; + //]; + ]); if (Util\Platform::isPhar()) { $commands[] = new Command\SelfUpdate(); $commands[] = new Command\UtilTemplatesExtract(); diff --git a/src/Command/UtilTranslationsExtract.php b/src/Command/UtilTranslationsExtract.php index 59c57cf09..2060245a1 100644 --- a/src/Command/UtilTranslationsExtract.php +++ b/src/Command/UtilTranslationsExtract.php @@ -49,6 +49,12 @@ protected function configure(): void new InputOption('save', null, InputOption::VALUE_NONE, 'Should the extract be done'), new InputOption('format', null, InputOption::VALUE_OPTIONAL, 'Override the default output format', 'po'), new InputOption('theme', null, InputOption::VALUE_OPTIONAL, 'Use if you want to translate a theme layouts too'), + new InputOption('theme', null, InputOption::VALUE_REQUIRED, 'Merge translation messages from a given theme', null, + function (): array { + $availableThemes = $this->getBuilder()->getConfig()->getTheme(); + return $availableThemes; + } + ), ]) ->setHelp( <<<'EOF' From d4dee4411ff50c081b8fb61bb8f7560113673764 Mon Sep 17 00:00:00 2001 From: Arnaud Ligny Date: Tue, 11 Feb 2025 11:56:27 +0100 Subject: [PATCH 2/2] Apply fixes from StyleCI (#2110) --- src/Command/UtilTranslationsExtract.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/Command/UtilTranslationsExtract.php b/src/Command/UtilTranslationsExtract.php index 2060245a1..a275b31c2 100644 --- a/src/Command/UtilTranslationsExtract.php +++ b/src/Command/UtilTranslationsExtract.php @@ -49,7 +49,12 @@ protected function configure(): void new InputOption('save', null, InputOption::VALUE_NONE, 'Should the extract be done'), new InputOption('format', null, InputOption::VALUE_OPTIONAL, 'Override the default output format', 'po'), new InputOption('theme', null, InputOption::VALUE_OPTIONAL, 'Use if you want to translate a theme layouts too'), - new InputOption('theme', null, InputOption::VALUE_REQUIRED, 'Merge translation messages from a given theme', null, + new InputOption( + 'theme', + null, + InputOption::VALUE_REQUIRED, + 'Merge translation messages from a given theme', + null, function (): array { $availableThemes = $this->getBuilder()->getConfig()->getTheme(); return $availableThemes;