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

$autoloaderPath = 'phar://bb-cli.phar/vendor/autoload.php';
if (!strpos(basename(__FILE__), 'phar')) {
    if (file_exists(__DIR__.'/vendor/autoload.php')) {
        $autoloaderPath = __DIR__.'/vendor/autoload.php';
    } elseif (file_exists(__DIR__.'/../../autoload.php')) {
        $autoloaderPath = __DIR__ . '/../../autoload.php';
    } else {
        echo "cannot load autoload \n";
    }
}

$classLoader = require $autoloaderPath;
$runner = new \Bitbull\Cli\Runner();
$runner->setClassLoader($classLoader);
$statusCode = $runner->execute($_SERVER['argv']);
exit($statusCode);
