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

use Wex\App;
use Wex\Command;

error_reporting(E_ALL);
ini_set('display_errors', 1);

require 'vendor/autoload.php';

$command    = $_SERVER['argv'][1] ?? null;
$parameters = array_slice($_SERVER['argv'] ?? [], 2);

try {
    $cli = App::bootstrap()->cli($command, $parameters);
    $cli();
} catch (\Exception $e) {
    Command::error($e->getMessage());
    exit(-1);
}