Find a command by task:action name

@return Object
329573
public function find($name)
    {
        $exp = explode(':', $name);
        $task = strtolower($exp[0]);
        $action = $exp[1];

        if (array_key_exists($task, $this->library)) {
            if (in_array($action, $this->library[$task]['actions'])) {
                return $this->library[$task]['class'];
            }
        }

        // Not sure whether to throw an exception here?
        throw new Exceptions\CommandNotFoundException($name);
    }
589467
public function getActionName()
    {
        $actionId = $this->getViewParameter('action');
        $action   = oxNew(\OxidEsales\Eshop\Application\Model\Actions::class);
        if ($action->load($actionId)) {
            return $action->oxactions__oxtitle->value;
        }
    }
1093809
public function getActionKey()
    {
        if ($this->receiver !== null) {
            if ($this->role->getWorkspace() === null) {
                return $this::ACTION_USER;
            } else {
                return $this::ACTION_WORKSPACE_USER;
            }
        } else {
            if ($this->role->getWorkspace() === null) {
                return $this::ACTION_GROUP;
            } else {
                return $this::ACTION_WORKSPACE_GROUP;
            }
        }
    }
745929
static public function findForExecute()
    {
        return static::find()->active()
            ->andWhere([
                'is_running' => Cms::BOOL_N
            ])
            ->andWhere([
                '<=',
                'next_exec_at',
                \Yii::$app->formatter->asTimestamp(time())
            ])->orderBy('priority');
    }
196894
public function getActionMapper()
    {
        if (null === $this->actionMapper) {
            $this->actionMapper = $this->serviceLocator->get('playgroundflow_action_mapper');
        }

        return $this->actionMapper;
    }
1364144
public function getActionName()
    {
        if (null === $this->action) {
            $this->setActionName($this->getActionDefault());
        }

        return $this->action;
    }
769013
public static function parseAndRunCommand($command)
    {
        try {
            list($class, $method, $args) = TaskManager::parseCommand($command);
            if (!class_exists($class)) {
                TaskLoader::loadController($class);
            }

            $obj = new $class();
            if (!method_exists($obj, $method)) {
                throw new TaskManagerException('method ' . $method . ' not found in class ' . $class);
            }

            return call_user_func_array(array($obj, $method), $args);
        } catch (\Exception $e) {
            echo 'Caught an exception: ' . get_class($e) . ': ' . PHP_EOL . $e->getMessage() . PHP_EOL;
            return false;
        }
    }
1333672
protected function findShell()
	{
		if (self::$shell)
		{
			return self::$shell;
		}

		$command = "/usr/bin/env %s -c 'echo Hello'";

		foreach (array('bash', 'zsh', 'ksh', 'csh') as $shell)
		{
			if (rtrim(shell_exec(sprintf($command, $shell))) === 'Hello')
			{
				self::$shell = $shell;

				return $shell;
			}
		}

		return null;
	}
1320048
protected function getCommandFactory()
    {
        if (!$this->commandFactory) {
            $this->commandFactory = CompositeFactory::getDefaultChain($this);
        }

        return $this->commandFactory;
    }
898438
protected function _getCommand()
        {
            $command = $this->_bin;

            $command .= ($this->getCopies() > 1) ? " --copies " . $this->getCopies() : "";
            $command .= " --orientation " . $this->getOrientation();
            $command .= " --page-size " . $this->getPageSize();

            foreach($this->getMargins() as $position => $margin) {
                $command .= (false === is_null($margin)) ? sprintf(' --margin-%s %s', $position, $margin) : '';
            }

            $command .= ($this->getWindowStatus()) ? " --window-status ".$this->getWindowStatus()."" : "";
            $command .= ($this->getTOC()) ? " --toc" : "";
            $command .= ($this->getGrayscale()) ? " --grayscale" : "";
            $command .= (mb_strlen($this->getPassword()) > 0)
            ? " --password " . $this->getPassword() . ""
            : "";
            $command .= (mb_strlen($this->getUsername()) > 0)
            ? " --username " . $this->getUsername() . ""
            : "";
            $command .= (mb_strlen($this->getFooterHtml()) > 0)
            ? " --margin-bottom 20 --footer-html \"" . $this->getFooterHtml() . "\""
            : "";
            $command .= ($this->getTitle())
            ? ' --title "' . $this->getTitle() . '"'
            : '';

            $command .= ' "%input%"';
            $command .= " -";
            if ($this->getRunInVirtualX()) {
                $command = 'xvfb-run ' . $command;
            }
            return $command;
        }
558207
protected function getTaskActions() {
        if (!$this->_taskActions) {
            $this->_taskActions = new TaskActionsList(
                $this->version,
                $this->solution['assistantSid'],
                $this->solution['sid']
            );
        }

        return $this->_taskActions;
    }
30386
public function getHelp()
	{
		$help='Usage: '.$this->getCommandRunner()->getScriptName().' '.$this->getName();
		$options=$this->getOptionHelp();
		if(empty($options))
			return $help."\n";
		if(count($options)===1)
			return $help.' '.$options[0]."\n";
		$help.=" <action>\nActions:\n";
		foreach($options as $option)
			$help.='    '.$option."\n";
		return $help;
	}
1358607
public function getCommand()
    {
        if (is_null($this->commandName)) {
            throw new \RuntimeException("You should pass a commandName to execute a command");
        }

        $command = '';
        $command .= $this->getCLIConfigs();
        $command .= $this->getCLIGlobalOptions();
        $command .= $this->getCLICommandName();
        $command .= $this->getCLICommandArguments();
        $command .= $this->getCLISubjects();
        $command .= $this->getCLIPath();

        $command = preg_replace('/\\s{2,}/', ' ', $command);

        return trim($command);
    }
749515
public function get($name)
    {
        $this->init();

        if (!$this->has($name)) {
            throw new CommandNotFoundException(sprintf('The command "%s" does not exist.', $name));
        }

        $command = $this->commands[$name];

        if ($this->wantHelps) {
            $this->wantHelps = false;

            $helpCommand = $this->get('help');
            $helpCommand->setCommand($command);

            return $helpCommand;
        }

        return $command;
    }
1077481
public function findHandler(Command $command)
    {
        $command_name = get_class($command);

        return isset($this->handlers[$command_name]) ? $this->handlers[$command_name] : null;
    }
231263
public function find($name)
    {
        return $this->first(function ($action) use ($name) {
            return class_basename($action) === studly_case($name);
        });
    }
1222557
def getOperation(self, ps, action):
        '''
        '''
        opName = self.getOperationName(ps, action)
        return getattr(self, opName)