#!/usr/bin/env php
<?php
declare(strict_types=1);
$autoloadPaths = [
__DIR__ . '/../vendor/autoload.php',
__DIR__ . '/../../../autoload.php',
];
$loaded = false;
foreach ($autoloadPaths as $path) {
if (is_file($path)) {
require_once $path;
$loaded = true;
break;
}
}
if (!$loaded) {
fwrite(STDERR, "Error: Composer autoload.php not found. Run 'composer install'.\n");
exit(1);
}
$baseDir = getcwd() ?: dirname(__DIR__);
if (!is_file($baseDir . '/quick-config.php') && !is_file($baseDir . '/quick-sites.php')) {
$baseDir = dirname(__DIR__);
}
$app = new QuickWP\Cli\Application($baseDir);
$result = $app->execute($argv);
if ($result['code'] === 0) {
fwrite(STDOUT, $result['output']);
} else {
fwrite(STDERR, $result['output']);
}
exit($result['code']);
|