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

/*
 * This file is part of the Invoice Match CodeIgniter 4 application.
 *
 * The "spark" command-line tool. Run `php spark list` to see all commands,
 * `php spark migrate --all` to run framework + Shield + app migrations.
 */

// Refuse to run when called from php-cgi.
if (str_starts_with(PHP_SAPI, 'cgi')) {
    exit("The cli tool is not supported when running php-cgi. It needs php-cli to function!\n\n");
}

/*
 *---------------------------------------------------------------
 * BOOTSTRAP THE APPLICATION
 *---------------------------------------------------------------
 */
define('FCPATH', __DIR__ . DIRECTORY_SEPARATOR . 'public' . DIRECTORY_SEPARATOR);

// Load our paths config file.
require realpath('app/Config/Paths.php') ?: 'app/Config/Paths.php';
$paths = new Config\Paths();

// Location of the framework bootstrap file.
require $paths->systemDirectory . '/Boot.php';

exit(CodeIgniter\Boot::bootSpark($paths));
