#!/usr/bin/env php
<?php declare(strict_types=1);

use MongoDB\CodeGenerator\Command\GenerateCommand;
use Symfony\Component\Console\Application;

if (!file_exists(__DIR__ . '/vendor/autoload.php')) {
    echo "Run `composer install` before you run the `console` script.\n";
    exit(1);
}

if (!file_exists(__DIR__ . '/mql-specifications')) {
    echo "The `mql-specifications` submodule is not initialized. Run `git submodule update --init`.\n";
    exit(1);
}

require __DIR__ . '/vendor/autoload.php';

$application = new Application();
$application->add(new GenerateCommand(__DIR__ . '/../', __DIR__));
$application->setDefaultCommand('generate', true);
$application->run();
