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

require_once "vendor/autoload.php";

use Symfony\Component\Console\Input\ArgvInput;
use Symfony\Component\Console\Application;

use DRI\SugarCRM\Plugin\Command;
use DRI\SugarCRM\Plugin\Path;

Path::setRootPath(getcwd());

$input = new ArgvInput($argv);

$application = new Application();

$application->addCommands(array (
    new Command\SymlinkCommand(),
    new Command\SyncCommand(),
    new Command\UninstallCommand(),
    new Command\PackageCommand(),
    new Command\ActionCommand(),
    new Command\ScanCommand(),
));

if (file_exists('commands.php')) {
    $commands = require 'commands.php';
    $application->addCommands($commands);
}

$application->run($input);
