#!/usr/bin/env php
<?php
$autoload = null;

$autoloadFiles = [
    __DIR__ . '/../vendor/autoload.php',
    __DIR__ . '/../../../autoload.php',
    __DIR__ . '/vendor/autoload.php'
];

foreach ($autoloadFiles as $autoloadFile) {
    if (file_exists($autoloadFile)) {
        $autoload = $autoloadFile;
        break;
    }
}

if (! $autoload) {
    echo "Autoload file not found; try 'composer dump-autoload' first." . PHP_EOL;
    exit(1);
}

require $autoload;
use Symfony\Component\Console\Application;
use Composer\InstalledVersions;


$package = \Composer\InstalledVersions::getRootPackage();

$application = new Application('backup', $package['version']);

$application->add(new App\CommandBackup());
$application->add(new App\CommandShow());

$application->run();