diff --git a/TODO.md b/TODO.md index 4ac298a..10121f4 100644 --- a/TODO.md +++ b/TODO.md @@ -184,7 +184,7 @@ PHP `max_execution_time` fatal can't be caught by `try/catch` at all, so - [ ] `.env` — document `CONTRIBUTIONS_RETENTION_DAYS` (empty by default), same style as the existing `ALLOWED_HOSTS` comment. -## 9. `app:contributions:refetch` console command +## 9. `graph:contributions:refetch` console command Manual escape hatch for forcing a full or ranged re-fetch (e.g. after adding a new host, or if the store needs rebuilding) — bypasses step 5's diff --git a/bin/console b/bin/console index f7ba6f7..f8e868b 100755 --- a/bin/console +++ b/bin/console @@ -1,7 +1,7 @@ #!/usr/bin/env php io = new SymfonyStyle($input, $output); + } + + public function __invoke( + //TODO: check if its possible to add the preview with real strings from the providers. + #[Option("(repeatable/comma-split, restricts to named provider(s), default = all configured", "provider", "p", "")] + string $providers = "" + ) { + $requested = $providers === '' ? null : explode(',', $providers); + $byName = []; + + foreach ($this->providers as $provider) { + $byName[$provider->getName()] = $provider; + } + + if ($requested !== null) { + foreach ($requested as $name) { + if (!isset($byName[$name])) { + $this->io->error("Unknown provider: {$name}"); + return Command::FAILURE; + } + } + $byName = array_intersect_key($byName, array_flip($requested)); + } + } +} diff --git a/src/Controller/GraphController.php b/src/Controller/GraphController.php index 18b520f..6d716c9 100644 --- a/src/Controller/GraphController.php +++ b/src/Controller/GraphController.php @@ -2,11 +2,11 @@ declare(strict_types=1); -namespace App\Controller; +namespace GitContributionGraph\Controller; -use App\Service\ContributionAggregator; -use App\Service\Provider\ProviderHealthChecker; -use App\Service\Renderer\SvgRenderer; +use GitContributionGraph\Service\ContributionAggregator; +use GitContributionGraph\Service\Provider\ProviderHealthChecker; +use GitContributionGraph\Service\Renderer\SvgRenderer; use Psr\Log\LoggerInterface; use Symfony\Component\DependencyInjection\Attribute\Autowire; use Symfony\Component\HttpFoundation\RedirectResponse; diff --git a/src/Entity/Contribution.php b/src/Entity/Contribution.php index 9e04820..2e05227 100644 --- a/src/Entity/Contribution.php +++ b/src/Entity/Contribution.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace App\Entity; +namespace GitContributionGraph\Entity; final class Contribution { diff --git a/src/Entity/ContributionCollection.php b/src/Entity/ContributionCollection.php index 60d26e7..eabbec0 100644 --- a/src/Entity/ContributionCollection.php +++ b/src/Entity/ContributionCollection.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace App\Entity; +namespace GitContributionGraph\Entity; /** * @implements \IteratorAggregate diff --git a/src/Kernel.php b/src/Kernel.php index 779cd1f..e8ad584 100644 --- a/src/Kernel.php +++ b/src/Kernel.php @@ -1,6 +1,6 @@