#!/usr/bin/env php
<?php
/**
 * MaplePHP bin file
 */

use MaplePHP\Core\CliKernel;

$autoload = __DIR__ . '/vendor/autoload.php';

if (!is_file($autoload)) {
    if (!empty($GLOBALS['_composer_autoload_path'])) {
        $autoload = $GLOBALS['_composer_autoload_path'];
    } else {
        fwrite(STDERR, "Autoloader not found. Run `composer install`.\n");
        exit(1);
    }
}

require $autoload;

$app = (new CliKernel(__DIR__))
    ->init()
    ->boot([
        "argv" => $argv,
        "dir" => getcwd()
    ]);
