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

use Simply\Maker\Command\CommandsRegistry;
use Symfony\Component\Console\Application;

/**
 * Not load full wp just files
 */
require __DIR__ . '/../web/wp/wp-load.php';

if (!class_exists(CommandsRegistry::class)) {
    throw new RuntimeException("Simply Maker extension must be loaded to use the CLI.");
}

$application = new Application();

/**
 * @var CommandsRegistry $registry
 */
$registry = Simply::get(CommandsRegistry::class);

if ($registry->hasCommands()) {
    $application->addCommands($registry->getCommands());
}
$application->run();
