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

if (file_exists(__DIR__.'/../vendor/autoload.php')) {
    $vendorDir = dirname(__DIR__).'/vendor';
} else if (file_exists(__DIR__.'/../autoload.php')) {
    $vendorDir = dirname(__DIR__);
} else {
    $vendorDir = dirname(__DIR__, 3);
}

require $vendorDir.'/autoload.php';

use Symfony\Component\Console\Application;
use Contao\MonorepoTools\Command\SplitCommand;
use Contao\MonorepoTools\Command\MergeCommand;
use Contao\MonorepoTools\Command\ComposerJsonCommand;

$rootDir = getcwd();

$application = new Application();
$application->add(new SplitCommand($rootDir));
$application->add(new MergeCommand($rootDir));
$application->add(new ComposerJsonCommand($rootDir));
$application->run();
