#!/usr/bin/env php
<?php

declare(strict_types=1);

use Peck\Console\Commands\CheckCommand;
use Symfony\Component\Console\Application;
use Symfony\Component\Console\CommandLoader\FactoryCommandLoader;

foreach ([
    dirname(__DIR__, 4).'/vendor/autoload.php',
    dirname(__DIR__).'/vendor/autoload.php',
] as $autoloadPath) {
    if (file_exists($autoloadPath)) {
        include_once $autoloadPath;

        break;
    }
}

$application = new Application(
    'Peck',
    '0.3.0',
);

$application->setCommandLoader(new FactoryCommandLoader([
    'check' => static fn (): CheckCommand => new CheckCommand,
]));

$application->setDefaultCommand('check');

$application->run();
