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

if (PHP_VERSION_ID < 50400) {
    file_put_contents('php://stderr', sprintf(
        "Vagrun requires PHP 5.4 version or higher and your system has\n".
        "PHP %s version installed.\n\n",
        PHP_VERSION
    ));

    exit(1);
}

require file_exists(__DIR__.'/vendor/autoload.php')
    ? __DIR__.'/vendor/autoload.php'
    : __DIR__.'/../../autoload.php';

$appVersion = '@package_version@';
$logo = "
 __  __     __        __      _ __   __  __    ___
/\ \/\ \  /'__`\    /'_ `\   /\`'__\/\ \/\ \ /' _ `\
\ \ \_/ |/\ \L\.\_ /\ \L\ \  \ \ \/ \ \ \_\ \/\ \/\ \
 \ \___/ \ \__/.\_\\\ \____ \  \ \_\  \ \____/\ \_\ \_\
  \/__/   \/__/\/_/  \/___L\ \  \/_/   \/___/  \/_/\/_/
                       /\____/
                       \_/__/

";

// Windows uses Path instead of PATH
if (!isset($_SERVER['PATH']) && isset($_SERVER['Path'])) {
    $_SERVER['PATH'] = $_SERVER['Path'];
}

$app = new Symfony\Component\Console\Application($logo, $appVersion);
$app->add(new Ideato\Vagrun\Command\InitCommand());
$app->add(new Ideato\Vagrun\Command\CleanUpCommand());
$app->add(new Ideato\Vagrun\Command\ConfigCommand());
$app->add(new Ideato\Vagrun\Command\Config\BaseCommand());
$app->add(new Ideato\Vagrun\Command\Config\VerboseCommand());
$app->add(new Ideato\Vagrun\Command\SelfUpdateCommand());

$app->run();
