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

namespace DBSeller\SafeCopy;

use DBSeller\SafeCopy\Console\Application;

try {

    $autoload = current(array_filter(
        array(
            __DIR__ . '/../vendor/autoload.php',
            __DIR__ . '/../../../autoload.php',
        ), 
        function($path) {
            return file_exists($path);
        }
    ));

    if (empty($autoload)) {
        throw new \Exception("dependencies not instaled\n");
    }

    require_once $autoload;

    $application = new Application('safe-copy', '1.0.0');
    $application->run();

} catch (\Exception $e) {

    echo 'ERROR: ' ,$e->getMessage(), PHP_EOL;
    echo $e->getTraceAsString(), PHP_EOL;
    exit(1);
}


