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

$autoloaders = array(
    __DIR__ . '/../vendor/autoload.php',
    __DIR__ . '/../../../autoload.php'
);

$classLoader = false;
foreach ($autoloaders as $autoloader) {
    if (@include_once($autoloader)) {
        $classLoader = $autoloader;
        break;
    }
}

if ($classLoader) {
    require_once $classLoader;
}

use Symfony\Component\Console\Application;
use Delegator\Magegen\Console\Command\BuildCommand;
use Delegator\Magegen\Console\Command\CheckCommand;
use Delegator\Magegen\Console\Command\CleanCommand;
use Delegator\Magegen\Console\Command\InitCommand;

$application = new Application();
$application->setName('Magegen - Build system for Magento extensions.');
$application->setVersion('0.2.0');
$application->add(new BuildCommand);
$application->add(new CheckCommand);
$application->add(new CleanCommand);
$application->add(new InitCommand);
$application->run();
