diff --git a/src/Commands/HelpCommand.php b/src/Commands/HelpCommand.php
index 72b3dc8..268a9d2 100644
--- a/src/Commands/HelpCommand.php
+++ b/src/Commands/HelpCommand.php
@@ -4,10 +4,11 @@ declare(strict_types=1);
namespace Phred\Tasker\Commands;
-use Phred\Tasker\Runner;
use Phred\ConsoleContracts\CommandInterface;
use Phred\ConsoleContracts\InputInterface;
use Phred\ConsoleContracts\OutputInterface;
+use Phred\Tasker\Runner;
+use Phred\TaskerBridges\Phred\TableAdapter;
class HelpCommand implements CommandInterface
{
@@ -70,18 +71,22 @@ class HelpCommand implements CommandInterface
$arguments = $command->getArguments();
if ($arguments) {
$output->writeln('Arguments:');
+ $table = new TableAdapter($output);
foreach ($arguments as $name => $desc) {
- $output->writeln(sprintf(' %s %s', str_pad($name, 20), $desc));
+ $table->addRow(["{$name}", $desc]);
}
+ $table->render();
$output->writeln('');
}
$options = $command->getOptions();
if ($options) {
$output->writeln('Options:');
+ $table = new TableAdapter($output);
foreach ($options as $name => $desc) {
- $output->writeln(sprintf(' %s %s', str_pad($name, 20), $desc));
+ $table->addRow(["{$name}", $desc]);
}
+ $table->render();
$output->writeln('');
}
diff --git a/src/Commands/ListCommand.php b/src/Commands/ListCommand.php
index e9025e7..556906e 100644
--- a/src/Commands/ListCommand.php
+++ b/src/Commands/ListCommand.php
@@ -8,6 +8,7 @@ use Phred\ConsoleContracts\CommandInterface;
use Phred\ConsoleContracts\InputInterface;
use Phred\ConsoleContracts\OutputInterface;
use Phred\Tasker\Runner;
+use Phred\TaskerBridges\Phred\TableAdapter;
class ListCommand implements CommandInterface
{
@@ -47,10 +48,18 @@ class ListCommand implements CommandInterface
$commands = $this->runner->getCommands();
ksort($commands);
+ $table = new TableAdapter($output);
+ $table->setHeaders(['Command', 'Description']);
+
foreach ($commands as $name => $command) {
- $output->writeln(sprintf(' %s %s', str_pad($name, 20), $command->getDescription()));
+ $table->addRow([
+ "{$name}",
+ $command->getDescription()
+ ]);
}
+ $table->render();
+
return 0;
}
}