#!/usr/bin/env php
<?php
require_once __DIR__ . '/vendor/autoload.php';
require_once __DIR__. '/config/config.php';

use Symfony\Component\Console\Application;
use Tufu\Core\ConfigManager;
use Tufu\Core\Console\Commands\GreetCommand;
use Tufu\Core\Console\Commands\MigrateCommand;
use Illuminate\Database\Capsule\Manager as Capsule;
use Tufu\Core\Console\Commands\MigrateRollbackCommand;
use Tufu\Core\Console\Commands\ResourceCreateCommand;

ConfigManager::setConfig($config);
$application = new Application();
$application->setName('Tufu console helper - Tufy');

$database = new Capsule();
$database->addConnection(ConfigManager::get('database'));
$database->setAsGlobal();
$database->bootEloquent();

# add our commands
$application->add(new GreetCommand());
$application->add(new MigrateCommand());
$application->add(new MigrateRollbackCommand());
$application->add(new ResourceCreateCommand());
$application->run();
