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

/*
 * This file is part of the guanguans/music-php.
 *
 * (c) 琯琯 <yzmguanguan@gmail.com>
 *
 * This source file is subject to the MIT license that is bundled.
 */

$loaded = false;

foreach ([__DIR__ . '/../../../autoload.php', __DIR__ . '/../vendor/autoload.php'] as $file) {
    if (file_exists($file)) {
        require $file;
        $loaded = true;
        break;
    }
}

if (!$loaded) {
    die(
        'You need to set up the project dependencies using the following commands:' . PHP_EOL .
        'wget http://getcomposer.org/composer.phar' . PHP_EOL .
        'php composer.phar install' . PHP_EOL
    );
}

define('APP_PATH', dirname(__DIR__));

use Guanguans\MusicPHP\Consoles\Application;
use Guanguans\MusicPHP\Commands\SearchCommand;

if (!config('debug')) {
    error_reporting(0);
}

$application = new Application();
$application->add(new SearchCommand());
$status = $application->run();
exit($status);
