<commit_before><?php

/*
 * This file is part of the Indigo Console package.
 *
 * (c) Indigo Development Team
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace Indigo\Console\Command;

use Indigo\Console\Application;
use League\CLImate\CLImate;

/**
 * Lists commands of application
 *
 * @author <NAME> <<EMAIL>>
 */
class Ls extends Basic
{
    /**
     * {@inheritdoc}
     */
    protected $name = 'list';

    /**
     * {@inheritdoc}
     */
    protected $description = 'Lists commands registered in application';

    /**
     * @param Application $application
     */
    public function __construct(Application $application)
    {
        $this->application = $application;
    }

    /**
     * {@inheritdoc}
     */
    public function execute(array $args, CLImate $output)
    {
        $commands = $this->application->getCommands();
        $table = [];

        foreach ($commands as $name => $command) {
            $table[] = [
                'name'        => $name,
                'description' => $command->getDescription()
            ];
        }

        $output->table($table);
    }
}<commit_msg>Updates list command to use colors and columns<commit_after><?php

/*
 * This file is part of the Indigo Console package.
 *
 * (c) Indigo Development Team
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace Indigo\Console\Command;

use Indigo\Console\Application;
use League\CLImate\CLImate;

/**
 * Lists commands of application
 *
 * @author <NAME> <<EMAIL>>
 */
class Ls extends Basic
{
    /**
     * {@inheritdoc}
     */
    protected $name = 'list';

    /**
     * {@inheritdoc}
     */
    protected $description = 'Lists commands registered in application';

    /**
     * @param Application $application
     */
    public function __construct(Application $application)
    {
        $this->application = $application;
    }

    /**
     * {@inheritdoc}
     */
    public function execute(array $args, CLImate $output)
    {
        $commands = $this->application->getCommands();
        $columns = [];

        foreach ($commands as $name => $command) {
            $columns[] = sprintf('<green>%s</green>', $name);
            $columns[] = $command->getDescription();
        }

        $output->yellow('Available commands:');
        $output->columns($columns, 2);
    }
}
{'fraction_non_alphanumeric': 0.13554578168732506, 'fraction_numerical': 0.00039984006397441024, 'mean_word_length': 2.3856562922868743, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 26, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6299906', 'n_tokens_mistral': 699, 'n_tokens_neox': 689, 'n_words': 194}