first commit.

This commit is contained in:
kj
2026-10-05 15:08:39 -03:00
commit b7799f9fff
93 changed files with 8966 additions and 0 deletions
@@ -0,0 +1,42 @@
<?php
namespace Toolbox\Commands;
use Toolbox\Installer;
use Toolbox\ToolboxException;
final class ListCommand extends Command
{
public static function describe(): string
{
return 'Lista el core y los componentes instalados';
}
public function run(array $args): int
{
$parsed = $this->parse($args);
$root = $this->root($parsed['options']);
$toolbox = $this->toolboxDir($parsed['options']);
$installer = new Installer($root, $toolbox, $this->console, $this->rootCore($parsed['options'], $root));
$rows = [['TIPO', 'ID', 'VERSIÓN', 'MODO']];
$core = $installer->lock()->core();
if ($core !== null) {
$rows[] = ['core', 'core', (string) ($core['version'] ?? '?'), 'copy'];
}
foreach ($installer->lock()->components() as $id => $entry) {
$rows[] = [$entry['package'], $id, $entry['version'], $entry['mode']];
}
if (count($rows) === 1) {
$this->console->out('No hay nada instalado.');
return 0;
}
$this->console->table($rows);
return 0;
}
}