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

const TLINT_VERSION = 'v6.3.0';

foreach (
    [
        __DIR__ . '/../../../../vendor/autoload.php',
        __DIR__ . '/../../autoload.php',
        __DIR__ . '/../vendor/autoload.php',
        __DIR__ . '/vendor/autoload.php',
    ] as $file) {
    if (file_exists($file)) {
        require $file;

        break;
    }
}

if (file_exists($appAutoloader = getcwd() . '/vendor/autoload.php')) {
    require $appAutoloader;
}

use Symfony\Component\Console\Application;
use Tighten\TLint\Commands\FormatCommand;
use Tighten\TLint\Commands\LintCommand;

$application = new Application('tlint', TLINT_VERSION);

$lintCommand = new LintCommand;
$application->add($lintCommand);
$application->add(new FormatCommand);
$application->setDefaultCommand($lintCommand->getName());

$application->run();
