Get aliases for given command.

@param Command $command

@return array
324157
protected function aliasesFor(Command $command): array
    {
        $aliases = [$name = $command->name()];

        foreach ($this->aliases as $alias => $command) {
            if (\in_array($name, [$alias, $command])) {
                $aliases[] = $alias;
                $aliases[] = $command;
            }
        }

        return $aliases;
    }
1343718
public function getFlags($command = null)
    {
        $option = $command ? 'flags.'.$command : 'flags';

        return $this->getOption($option, true);
    }
139215
protected function getKeyFromAllArguments(CommandInterface $command)
    {
        $arguments = $command->getArguments();

        if ($this->checkSameSlotForKeys($arguments)) {
            return $arguments[0];
        }
    }
1093199
protected function getKeyFromInterleavedArguments(string $command, array $arguments)
    {
        $keys = [];

        for ($i = 0, $n = \count($arguments); $i < $n; $i += 2) {
            $keys[] = $arguments[$i];
        }

        if ($this->checkSameSlotForKeys($keys)) {
            return $arguments[0];
        }

        return null;
    }
13970
public function exec( $command ) {
		$command .= ' 2>&1';
		$command = escapeshellcmd( $command );
		exec( $command, $output, $return_var );

		return [ $output, $return_var ];
	}
1239345
protected function getAliasesForAction($action)
    {
        $actions = [];

        foreach ($this->manager->getAliases() as $aliasName => $alias) {
            if ($alias->hasAction($action)) {
                $actions[] = $aliasName;
            }
        }

        return $actions;
    }
800868
public function get($command)
    {
        $commands = $this->getHandlers();
        return empty($commands[$command]) ? array() : $commands[$command];
    }
1326695
protected function getUrl(Command $command)
    {
        return $this->url
            .(stripos($this->url, '?') !== false ? '&' : '?')
            .http_build_query([self::COMMAND => $command->getName()]);
    }
457747
protected function getData($command)
    {
        $data = [];

        foreach ((new ReflectionClass($command))->getProperties(ReflectionProperty::IS_PUBLIC) as $property) {
            $name = $property->getName();
            $value = $property->getValue($command);

            if (in_array($name, ['rules', 'validationMessages'], true)) {
                continue;
            }

            $data[$name] = $value;
        }

        return $data;
    }
27836
public function getCommandConfiguration($command)
    {
        $url = "selendroid/configure/command/{$command}";
        $result = $this->driver->curl($this->driver->factoryCommand($url, WebDriver_Command::METHOD_GET));
        return isset($result['value']) ? $result['value'] : [];
    }
683884
public function drush($command) {
    // @todo Set to silent if verbosity is less than very verbose.
    $bin = $this->getConfigValue('composer.bin');
    /** @var \Robo\Common\ProcessExecutor $process_executor */
    $drush_alias = $this->getConfigValue('drush.alias');
    $command_string = "'$bin/drush' @$drush_alias $command";

    // URIs do not work on remote drush aliases in Drush 9. Instead, it is
    // expected that the alias define the uri in its configuration.
    if ($drush_alias != 'self') {
      $command_string .= ' --uri=' . $this->getConfigValue('site');
    }

    $process_executor = Robo::process(new Process($command_string));

    return $process_executor->dir($this->getConfigValue('docroot'))
      ->interactive(FALSE)
      ->printOutput(TRUE)
      ->printMetadata(TRUE)
      ->setVerbosityThreshold(VerbosityThresholdInterface::VERBOSITY_VERY_VERBOSE);
  }
306397
public function getVisibleCommands(): array
    {
        $commands = [];
        foreach ($this->commands as $name => $command) {
            if ($name[0] === '_') {
                continue;
            }

            $commands[$name] = $command;
        }

        return $commands;
    }
525016
public function getCommandCallbacks($command = null)
    {
        $result = array();
        if($command)
        {
            if(isset($this->__command_callbacks[$command])) {
                $result = $this->__command_callbacks[$command];
            }
        }
        else $result = $this->__command_callbacks;

        return $result;
    }
135791
protected function getAliasesByExtendsNamespace()
    {
        $aliases = $this->getValidAliases();

        $aliases = $aliases->filter(function (Alias $item) {
            return ! collect([
                'MessageStack',
                'AdminSection',
                'AdminTemplate',
                'AdminNavigation',
                'AdminColumn',
                'AdminColumnEditable',
                'AdminColumnFilter',
                'AdminDisplayFilter',
                'AdminForm',
                'AdminFormElement',
                'AdminDisplay',
            ])->search($item->getAlias());
        });

        return $aliases->groupBy(function (Alias $alias) {
            return $alias->getExtendsNamespace();
        });
    }
886131
protected function getKeyFromScriptingCommands(CommandInterface $command)
    {
        if ($command instanceof ScriptCommand) {
            $keys = $command->getKeys();
        } else {
            $keys = array_slice($args = $command->getArguments(), 2, $args[1]);
        }

        if ($keys && $this->checkSameSlotForKeys($keys)) {
            return $keys[0];
        }
    }
14766
public function execute(string $command) : array
    {
        $this->result = [];
        $process = new Process(
            $this->propelCommand . ' ' . $command . ' --config-dir=' . $this->configDir,
            $this->rootDirectory
        );

        $process->run([$this, 'handle']);

        return $this->result;
    }
1272141
public function getCommand($commandAlias)
    {
        if (!array_key_exists($commandAlias, $this->commands)) {
            throw new CommandException(sprintf('The command "%s" is not registered', $commandAlias));
        }

        return $this->commands[$commandAlias];
    }