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

include __DIR__ . '/../bootstrap/constants.php';

// Use Composer's autoloader locator
$autoloader = (static function() {
    $paths = [
        // Global installation path
        PROJECT_ROOT . '/../../../autoload.php',
        // Local installation path
        PROJECT_ROOT . '/vendor/autoload.php',
        // Path for development when working on the package itself
        PROJECT_ROOT . '/../../autoload.php',
    ];

    foreach ($paths as $path) {
        if (file_exists($path)) {
            return require $path;
        }
    }

    throw new Exception('Unable to find Composer autoloader. Please run "composer install".');
})();

use GregPriday\CopyTree\CopyTreeCommand;
use Symfony\Component\Console\Application;

$application = new Application();
$application->add(new CopyTreeCommand());
$application->setDefaultCommand('app:copy-tree', true);
$application->run();
