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

$loaded = false;

$autoloadFiles = [
    __DIR__.'/vendor/autoload.php',
    __DIR__.'/../vendor/autoload.php',
    __DIR__.'/../../vendor/autoload.php',
    __DIR__.'/../../../vendor/autoload.php',
];

foreach ($autoloadFiles as $autoloadFile) {
    if (file_exists($autoloadFile)) {
        require $autoloadFile;
        $loaded = true;

        break;
    }
}

if (!$loaded) {
    die('Can not find autoload.php file.');
}

use BeechIt\JsonToCodeClimateSubsetConverter\Command\ConverterCommand;
use BeechIt\JsonToCodeClimateSubsetConverter\Factories\CommandFactory;
use PHLAK\Config\Config;
use Symfony\Component\Console\Application;

$application = new Application();

$commandFactory = new CommandFactory();
$command = $commandFactory->build('convert');

$application->add($command);

$application->run();
