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

$path = dirname(__DIR__);
if (!is_file($path . '/vendor/autoload.php')) {
    $path = dirname(__DIR__, 4);
}

require $path . '/vendor/autoload.php';

use DMT\Laposta\Api\Console\CheckCustomFieldsCommand;
use DMT\Laposta\Api\Console\GenerateCustomFieldsCommand;
use Symfony\Component\Console\Application;
use Symfony\Component\Console\CommandLoader\FactoryCommandLoader;

$commandLoader = new FactoryCommandLoader([
    GenerateCustomFieldsCommand::getDefaultName() => fn() => new GenerateCustomFieldsCommand(),
    CheckCustomFieldsCommand::getDefaultName() => fn() => new CheckCustomFieldsCommand(),
]);

$application = new Application();
$application->setCommandLoader($commandLoader);
$application->run();
