<?php

namespace App\Commands;

use App\Services\Command;
use App\Services\Docker;
use Illuminate\Support\Facades\Process;

class Export extends Command
{
    protected $signature = 'export';
    protected $description = 'Create a built Wordpress installation within the docker environment and export it to the build folder';

    public function handle(): void
    {

        $binCommand = Docker::exec(command: './bin/build.sh');

        Process::forever()->tty()->run($binCommand, function (string $type, string $output) {
            echo $output;
        });
    }
}
