Skip to content

Commit

Permalink
add progress bar to gen commands
Browse files Browse the repository at this point in the history
  • Loading branch information
jrmajor committed Mar 2, 2024
1 parent e31b495 commit 8b0ec49
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
6 changes: 5 additions & 1 deletion dev/Rules/CompileRulesCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
use Major\PluralRules\Dev\Helpers\LocaleFiles;
use Symfony\Component\Console\Attribute\AsCommand;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Helper\ProgressBar;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;

Expand All @@ -18,10 +19,13 @@ protected function execute(InputInterface $input, OutputInterface $output): int

LocaleFiles::prepareDirectory('rules');

foreach (CldrData::rules() as $locale => $rules) {
$progressBar = new ProgressBar($output);

foreach ($progressBar->iterate(CldrData::rules()) as $locale => $rules) {
(new RuleCompiler($locale, $rules))->compile();
}

$output->writeln('');
$output->writeln('<info>Compiled in ' . round(microtime(true) - $start, 2) . 's</info>');

return Command::SUCCESS;
Expand Down
6 changes: 5 additions & 1 deletion dev/Tests/CompileTestsCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
use Major\PluralRules\Dev\Helpers\LocaleFiles;
use Symfony\Component\Console\Attribute\AsCommand;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Helper\ProgressBar;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;

Expand All @@ -18,10 +19,13 @@ protected function execute(InputInterface $input, OutputInterface $output): int

LocaleFiles::prepareDirectory('tests');

foreach (CldrData::rules() as $locale => $rules) {
$progressBar = new ProgressBar($output);

foreach ($progressBar->iterate(CldrData::rules()) as $locale => $rules) {
(new TestCompiler($locale, $rules))->compile();
}

$output->writeln('');
$output->writeln('<info>Compiled in ' . round(microtime(true) - $start, 2) . 's</info>');

return Command::SUCCESS;
Expand Down

0 comments on commit 8b0ec49

Please sign in to comment.