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

require __DIR__ . '/../../vendor/autoload.php';

use Castor\Console\Command\CompileCommand;
use Castor\Helper\PlatformHelper;
use Symfony\Component\Console\Application;
use Symfony\Component\Console\Command\Command;

$command = (new class() extends CompileCommand {
        public function __construct() {
            Command::__construct();
        }}
    )
    ->setCode(Closure::bind(
        fn($input) => (print PlatformHelper::getDefaultCacheDirectory() . '/castor-php-static-compiler/' . $this->generatePHPBuildCacheKey($input)) && 0,
        null,
        CompileCommand::class
    ))
;

(new Application())
    ->add($command)
    ->getApplication()
    ->setDefaultCommand($command->getName(), true)
    ->run()
;
