<?php
// CoreFlux/core/CLI/Commands/HelpCommand.php

namespace Core\CLI\Commands;

use Core\CLI\Command;

class HelpCommand implements Command
{
    private $commands;

    public function __construct(array $commands)
    {
        $this->commands = $commands;
    }

    public function getName(): string
    {
        return 'help';
    }

    public function getDescription(): string
    {
        return 'Displays this help message.';
    }

    public function execute(array $args): int
    {
        echo PHP_EOL . "CoreFlux CLI - Available Commands:" . PHP_EOL . PHP_EOL;

        foreach ($this->commands as $command) {
            echo "  " . str_pad($command->getName(), 30) . $command->getDescription() . PHP_EOL;
        }

        return 0;
    }
}