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

use Tempa\Console\Command\InteractiveCommand;
use Tempa\Console\Command\ScanCommand;
use Tempa\Console\Command\SubstituteCommand;
use Symfony\Component\Console\Application;

if (is_dir($vendor = __DIR__ . '/../vendor')) {
    require $vendor . '/autoload.php';
} elseif (is_dir($vendor = __DIR__ . '/../../..')) {
    require $vendor . '/autoload.php';
} else {
    die(
        'You must set up the project dependencies.' . PHP_EOL .
        'To do that, run the following commands:' . PHP_EOL . PHP_EOL .
        '$ curl -s http://getcomposer.org/installer | php' . PHP_EOL .
        '$ php composer.phar install' . PHP_EOL
    );
}

if (!class_exists('Symfony\Component\Console\Application')) {
    die(
        'You must install the symfony/console package in order ' .
        'to use the command-line tool.' . PHP_EOL
    );
}

$app = new Application();
$app->add(new ScanCommand());
$app->add(new SubstituteCommand());
$app->add(new InteractiveCommand());
$app->run();
