Create a new command list.

@return array
511835
private function createCommandList()
    {
        $list = [];

        // read all core commands
        $this->listCommands($list, __DIR__ . '/../Commands', 'Core\Commands');

        // merge all plugin commands (plugin overrides the core)
        if (file_exists($this->pluginManifestOfCommands)) {
            /** @noinspection PhpIncludeInspection */
            $list = array_merge($list, include $this->pluginManifestOfCommands);
        }

        // merge all commands defined by application (application overrides all other)
        $this->listCommands($list, app_path('Commands'), 'App\Commands');

        // save the new command list
        ksort($list);

        return $list;
    }
94332
private function resolveCommands()
    {
        $commands = [];
        foreach ($this->getParameter('commands') as $cmd) {
            $commands[] = is_array($cmd) ? (new ProcessBuilder($cmd))->getProcess() : new Process($cmd);
        }

        return $commands;
    }
1269890
protected function getDefaultCommands()
    {

        $shell = new Shell(dirname(VENDOR_PATH));

        $handlers = [
            'source' => new Handler\Source($shell),
            'coverage' => new Handler\Coverage(),
            'pdepend' => new Handler\PDepend($shell),
            'dependencies' => new Handler\Dependencies($shell),
            'phpmd' => new Handler\PHPMD($shell),
            'checkstyle' => new Handler\Checkstyle($shell),
            'tests' => new Handler\Tests(),
            'cpd' => new Handler\CPD($shell),
            'phploc' => new Handler\Phploc($shell),
            'git' => new Handler\Git($shell),
            'gitDetailed' => new Handler\GitDetailed($shell),
        ];

        return array_merge(
            parent::getDefaultCommands(),
            [
                new Command\Serve(),
                new Command\Bundle(),
                new Command\Analyze($handlers),
                new Command\Analyzers($handlers),
            ]
        );
    }
515085
private function parserCmdAndDesc(): array
    {
        $commands = [];
        $collector = CommandCollector::getCollector();

        /* @var \Swoft\Console\Router\HandlerMapping $route */
        $route = App::getBean('commandRoute');

        foreach ($collector as $className => $command) {
            if (!$command['enabled']) {
                continue;
            }

            $rc = new \ReflectionClass($className);
            $docComment = $rc->getDocComment();
            $docAry = DocBlockHelper::getTags($docComment);

            $prefix = $command['name'];
            $prefix = $route->getPrefix($prefix, $className);
            $commands[$prefix] = StringHelper::ucfirst($docAry['Description']);
        }

        // sort commands
        ksort($commands);

        return $commands;
    }
178126
protected function getBitrixCommands()
    {
        return array_merge(
            [
                new OnCronCommand(),
                new ExecuteCommand(),
                new ClearCommand(),
                new InitCommand(),
                new ReIndexCommand(),
                new ExportCommand(),
                new ImportCommand(),
                new ReIndexCommand(),
            ],
            Module\ModuleCommand::getCommands()
        );
    }
1317709
public function getArguments()
    {
        $returnArray = [];
        foreach ($this->commandArguments as $argument) {
            $returnArray[$argument->getName()] = $argument->getValue();
        }
        return $returnArray;
    }
474839
protected function getCommands()
    {
        // construct command classes path depending on grp_cmd flag
        $cmdPath = rtrim(__DIR__ . "/" . $this->data['cmd_path'], '/') . '/';
        $cmdPath .= ($this->data['grp_cmd']) ? "*/*.php" : "*.php";

        // construct commad path regex depending on grp_cmd flag
        $cmdPattern = ($this->data['grp_cmd'])
            ? '/^.*\/([^\/]+)\/([^\/]+)\.php$/'
            : '/^.*\/([^\/]+)\.php$/';

        // find all command files and commands
        $commands = [];
        foreach (glob($cmdPath) as $file) {
           // match only php files, extract group dir name
            if (!preg_match($cmdPattern, $file, $matches)) {
                continue;
            }

            // construct a class name from our namespace, optional
            // command group subdir and actual class file name
            $className = __NAMESPACE__ . "\\" . str_replace("/", "\\", $this->data['cmd_path']) . $matches[1];
            $className .= ($this->data['grp_cmd']) ? "\\" . $matches[2] : "";

            // skip if class doesn't exist
            if (!class_exists($className)) {
                continue;
            }

            // add to our commands list
            $commands []= $className;
        }

        if (!empty($this->data['config']['extra_commands']) && is_array($this->data['config']['extra_commands'])) {
            $commands = array_merge($commands, $this->data['config']['extra_commands']);
        }

        return $commands;
    }
256873
public function defaultCommands()
    {
        return [
            'server' => [
                'class' => ServerCommand::class,
            ],
            'server:start' => [
                'class' => ServerStartCommand::class,
            ],
            'server:stop' => [
                'class' => ServerStopCommand::class,
            ],
            'server:restart' => [
                'class' => ServerRestartCommand::class,
            ],
            'server:reload' => [
                'class' => ServerReloadCommand::class,
            ],
            'server:serve' => [
                'class' => ServerServeCommand::class,
            ],
            'shell' => [
                'class' => ShellCommand::class,
            ],
            'service:install' => [
                'class' => ServiceInstallCommand::class,
            ],
            'service:uninstall' => [
                'class' => ServiceUninstallCommand::class,
            ],
        ];
    }
636222
public function buildCommands()
    {
        $result = [];
        $pluginsCollection = $this->pluginManager->getPluginCollection();

        foreach ($pluginsCollection as $plugin) {
            if ($this->isValidCommandPlugin($plugin) === true) {
                $result[] = $this->buildCommand($plugin);
            }
        }

        return $result;
    }
1311785
public function requestCommands(): array
    {
        if ($this->_requestCommands === null) {
            $reflection = new ReflectionClass($this);

            $commands = [];
            foreach ($reflection->getConstants() as $name => $value) {
                if (strpos($name, 'RC_') === 0) {
                    $commands[] = $value;
                }
            }

            return $this->_requestCommands = $commands;
        } else {
            return $this->_requestCommands;
        }
    }
1284071
public static function commands(){
       $results = [];
       foreach(static::$commands as $name => $cmd){
          $results[] = [
            'name'        => $name,
            'params'      => preg_replace('/:(\w+)/','[$1]',implode(' ',$cmd[0])),
            'description' => $cmd[2],
          ];
       }
       return $results;
    }
466077
protected function registerListCommand()
    {
        $this->app->singleton('command.module.list', function ($app) {
            return new \Caffeinated\Modules\Console\Commands\ModuleListCommand($app['modules']);
        });

        $this->commands('command.module.list');
    }
746869
private function createFromCommand()
    {
        $command = BranchCommand::getInstance($this->getRepository())->listBranches();
        $outputLines = $this->repository->getCaller()->execute($command)->getOutputLines(true);
        foreach ($outputLines as $outputLine) {
            $matches = static::getMatches($outputLine);

            if ($this->name === $matches[1]) {
                $this->parseOutputLine($outputLine);

                return;
            }
        }

        throw new InvalidBranchNameException(sprintf('The %s branch doesn\'t exists', $this->name));
    }
175621
public function listCommand()
    {
        $workspaces = $this->workspaceRepository->findAll();

        if ($workspaces->count() === 0) {
            $this->outputLine('No workspaces found.');
            $this->quit(0);
        }

        $tableRows = [];
        $headerRow = ['Name', 'Base Workspace', 'Title', 'Owner', 'Description'];

        foreach ($workspaces as $workspace) {
            $owner = $workspace->getOwner() ? $workspace->getOwner()->getName() : '';
            $tableRows[] = [$workspace->getName(), ($workspace->getBaseWorkspace() ? $workspace->getBaseWorkspace()->getName() : ''), $workspace->getTitle(), $owner, $workspace->getDescription()];
        }
        $this->output->outputTable($tableRows, $headerRow);
    }
543498
public function commandBar(): array
    {
        return [

            Link::name('Example Button')
                ->method('example')
                ->icon('icon-bag'),

            Link::name('Example Modals')
                ->modal('exampleModal')
                ->title('Example Modals')
                ->icon('icon-full-screen'),

            Link::name('Example Group Button')
                ->icon('icon-folder-alt')
                ->group([

                    Link::name('Example Button')
                        ->method('example')
                        ->icon('icon-bag'),

                    Link::name('Example Button')
                        ->method('example')
                        ->icon('icon-bag'),

                    Link::name('Example Button')
                        ->method('example')
                        ->icon('icon-bag'),

                    Link::name('Example Button')
                        ->method('example')
                        ->icon('icon-bag'),

                    Link::name('Example Button')
                        ->method('example')
                        ->icon('icon-bag'),
                ]),

        ];
    }
1225770
public function listCommand()
    {
        $this->console->writeLn('manaphp commands:', Console::FC_GREEN | Console::AT_BOLD);
        foreach (glob(__DIR__ . '/*Controller.php') as $file) {
            $plainName = basename($file, '.php');
            if (in_array($plainName, ['BashCompletionController', 'HelpController'], true)) {
                continue;
            }
            $this->console->writeLn(' - ' . $this->console->colorize(Text::underscore(basename($plainName, 'Controller')), Console::FC_YELLOW));
            $commands = $this->_getCommands(__NAMESPACE__ . "\\" . $plainName);

            $width = max(max(array_map('strlen', array_keys($commands))), 18);
            foreach ($commands as $command => $description) {
                $this->console->writeLn('    ' . $this->console->colorize($command, Console::FC_CYAN, $width) . ' ' . $description);
            }
        }

        if ($this->alias->has('@cli')) {
            $this->console->writeLn('application commands: ', Console::FC_GREEN | Console::AT_BOLD);

            foreach (glob($this->alias->resolve('@cli/*Controller.php')) as $file) {
                $plainName = basename($file, '.php');
                $this->console->writeLn(' - ' . $this->console->colorize(Text::underscore(basename($plainName, 'Controller')), Console::FC_YELLOW));

                $commands = $this->_getCommands($this->alias->resolveNS("@ns.cli\\$plainName"));

                $width = max(max(array_map('strlen', array_keys($commands))), 18);
                foreach ($commands as $command => $description) {
                    $this->console->writeLn('    ' . $this->console->colorize($command, Console::FC_CYAN, $width + 1) . ' ' . $description);
                }
            }
        }

        return 0;
    }
1372808
protected function getDefaultCommands()
    {
        $commands = parent::getDefaultCommands();

        $commands[] = new Command\App\AppAdd();
        $commands[] = new Command\App\AppRemove();
        $commands[] = new Command\Environment\EnvironmentAdd();
        $commands[] = new Command\Environment\EnvironmentRemove();
        $commands[] = new Command\Environment\EnvironmentEnable();
        $commands[] = new Command\Environment\EnvironmentDisable();
        $commands[] = new Command\Environment\EnvironmentDeploy();
        $commands[] = new Command\Environment\EnvironmentShell();
        $commands[] = new Command\Environment\EnvironmentScale();
        $commands[] = new Command\Environment\EnvironmentProxyEnable();
        $commands[] = new Command\Environment\EnvironmentTest();
        $commands[] = new Command\Environment\EnvironmentRebuild();
        $commands[] = new Command\Environment\EnvironmentDomains();
        $commands[] = new Command\Environment\EnvironmentDrush();
        $commands[] = new Command\Environment\EnvironmentRun();
        $commands[] = new Command\Environment\EnvironmentUpdate();
        $commands[] = new Command\Status();
        $commands[] = new Command\Queue();

        return $commands;
    }