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

$_ENV['HOME'] = getenv('HOME');
$_ENV['VAGRANT_DOTFILE_PATH'] = legacystead_path().DIRECTORY_SEPARATOR.'.vagrant';

if (file_exists(__DIR__.'/vendor/autoload.php'))
{
	require __DIR__.'/vendor/autoload.php';
}
else
{
	require __DIR__.'/../../autoload.php';
}

function legacystead_path()
{
	if (isset($_SERVER['HOME']))
	{
		return $_SERVER['HOME'].'/.legacystead';
	}
	else
	{
		return $_SERVER['HOMEDRIVE'].$_SERVER['HOMEPATH'].DIRECTORY_SEPARATOR.'.legacystead';
	}
}

$app = new Symfony\Component\Console\Application('Redtree Legacystead', '2.0.17');

$app->add(new Redtree\Legacystead\DestroyCommand);
$app->add(new Redtree\Legacystead\EditCommand);
$app->add(new Redtree\Legacystead\HaltCommand);
$app->add(new Redtree\Legacystead\InitCommand);
$app->add(new Redtree\Legacystead\ProvisionCommand);
$app->add(new Redtree\Legacystead\ResumeCommand);
$app->add(new Redtree\Legacystead\RunCommand);
$app->add(new Redtree\Legacystead\UpCommand);
$app->add(new Redtree\Legacystead\UpdateCommand);
$app->add(new Redtree\Legacystead\SshCommand);
$app->add(new Redtree\Legacystead\StatusCommand);
$app->add(new Redtree\Legacystead\SuspendCommand);

$app->run();