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

namespace Zend\Expressive\Tooling;

use Symfony\Component\Console\Application;
use Symfony\Component\Console\Input\ArgvInput;

// Setup/verify autoloading
if (file_exists($a = __DIR__ . '/../../../autoload.php')) {
    require $a;
} else if (file_exists($a = __DIR__ . '/../vendor/autoload.php')) {
    require $a;
} else if (file_exists($a = __DIR__ . '/../autoload.php')) {
    require $a;
} else {
    fwrite(STDERR, 'Cannot locate autoloader; please run "composer install"' . PHP_EOL);
    exit(1);
}
$application = new Application('cli');
$application->addCommands(
    [
        new \ApigilityTools\Cli\SplitConfig\SplitConfigCommand('config.split'),
        new \ApigilityTools\Cli\SplitConfig\CompactConfigCommand('config.compact'),
        new \ApigilityTools\Cli\CreateRest\CreateRestApiCommand('create.rest.api'),
        new \ApigilityTools\Cli\CreateRest\CreateRestHasApiCommand('create.rest.has.api'),
        new \ApigilityTools\Cli\CreateRest\CreateRestServiceCommand('create.rest.service'),
        new \ApigilityTools\Cli\CreateRest\CreateRestHasServiceCommand('create.rest.has.service'),
        new \ApigilityTools\Cli\CreateRest\LoadRestApiDbInputFilterCommand('load.db.input.filter'),
    ]);
$input= new ArgvInput();
$input->setInteractive(true);
$application->run($input);
