public function execute(array $args, array $options = [])
{
$this->writeln("CmlPHP Console " . Cml::VERSION . "\n", ['foregroundColors' => [Colour::GREEN, Colour::HIGHLIGHT]]);
$format = new Format(['indent' => 2]);
if (empty($args)) {
$this->writeln("Usage:");
$this->writeln($format->format("input 'command [options] [args]' to run command or input 'help command ' to display command help info"));
$this->writeln('');
$options = $this->formatOptions();
$cmdList = $this->formatCommand();
$this->writeln("Options:");
$this->formatEcho($format, $options);
$this->writeln('');
$this->writeln('Available commands:');
$this->formatEcho($format, $cmdList[0]);
$this->formatEcho($format, $cmdList[1]);
} else {
$class = new \ReflectionClass($this->console->getCommand($args[0]));
$property = $class->getDefaultProperties();
$description = isset($property['description']) ? $property['description'] : '';
$help = isset($property['help']) ? $property['help'] : false;
$arguments = isset($property['arguments']) ? $property['arguments'] : [];
$options = isset($property['options']) ? $property['options'] : [];
$this->writeln("Usage:");
$this->writeln($format->format("{$args[0]} [options] [args]"));
$this->writeln('');
count($arguments) > 0 && ($arguments = $this->formatArguments($arguments));
$options = $this->formatOptions($options, 'this');
$this->writeln("Options:");
$this->formatEcho($format, $options);
$this->writeln('');
if (count($arguments)) {
$this->writeln("Arguments");
$this->formatEcho($format, $arguments);
$this->writeln('');
}
$this->writeln("Help:");
$this->writeln($format->format($help ? $help : $description));
}
$this->write("\n");
}