44 $this->
outputLine(
'Extbase %s', array(\
TYPO3\CMS\Core\Utility\ExtensionManagementUtility::getExtensionVersion(
'extbase')));
45 $this->
outputLine(
'usage: ' . $this->request->getCallingScript() .
' <command identifier>');
47 $this->
outputLine(
'See \'' . $this->request->getCallingScript() .
' help\' for a list of all available commands.');
61 if ($commandIdentifier === NULL) {
65 $command = $this->commandManager->getCommandByIdentifier($commandIdentifier);
66 }
catch (\
TYPO3\CMS\Extbase\Mvc\
Exception\CommandException $exception) {
79 $this->
outputLine(
'Extbase %s', array(\
TYPO3\CMS\Core\Utility\ExtensionManagementUtility::getExtensionVersion(
'extbase')));
80 $this->
outputLine(
'usage: ' . $this->request->getCallingScript() .
' <command identifier>');
82 $this->
outputLine(
'The following commands are currently available:');
83 foreach ($this->commandsByExtensionsAndControllers as $extensionKey => $commandControllers) {
85 $this->
outputLine(
'EXTENSION "%s":', array(strtoupper($extensionKey)));
86 $this->
outputLine(str_repeat(
'-', self::MAXIMUM_LINE_LENGTH));
87 foreach ($commandControllers as $commands) {
88 foreach ($commands as $command) {
89 $description = wordwrap($command->getShortDescription(), self::MAXIMUM_LINE_LENGTH - 43, PHP_EOL . str_repeat(
' ', 43), TRUE);
90 $shortCommandIdentifier = $this->commandManager->getShortestIdentifierForCommand($command);
91 $this->
outputLine(
'%-2s%-40s %s', array(
' ', $shortCommandIdentifier, $description));
96 $this->
outputLine(
'See \'' . $this->request->getCallingScript() .
' help <command identifier>\' for more information about a specific command.');
108 $this->
outputLine($command->getShortDescription());
111 $this->
outputLine(
'%-2s%s', array(
' ', $command->getCommandIdentifier()));
112 $commandArgumentDefinitions = $command->getArgumentDefinitions();
115 foreach ($commandArgumentDefinitions as $commandArgumentDefinition) {
116 if (!$commandArgumentDefinition->isRequired()) {
119 $usage .= sprintf(
' <%s>', strtolower(preg_replace(
'/([A-Z])/',
' $1', $commandArgumentDefinition->getName())));
122 $usage = $this->request->getCallingScript() .
' ' . $this->commandManager->getShortestIdentifierForCommand($command) . ($hasOptions ?
' [<options>]' :
'') . $usage;
126 $argumentDescriptions = array();
127 $optionDescriptions = array();
128 if ($command->hasArguments()) {
129 foreach ($commandArgumentDefinitions as $commandArgumentDefinition) {
130 $argumentDescription = $commandArgumentDefinition->getDescription();
131 $argumentDescription = wordwrap($argumentDescription, self::MAXIMUM_LINE_LENGTH - 23, PHP_EOL . str_repeat(
' ', 23), TRUE);
132 if ($commandArgumentDefinition->isRequired()) {
133 $argumentDescriptions[] = vsprintf(
' %-20s %s', array($commandArgumentDefinition->getDashedName(), $argumentDescription));
135 $optionDescriptions[] = vsprintf(
' %-20s %s', array($commandArgumentDefinition->getDashedName(), $argumentDescription));
139 if (count($argumentDescriptions) > 0) {
142 foreach ($argumentDescriptions as $argumentDescription) {
146 if (count($optionDescriptions) > 0) {
149 foreach ($optionDescriptions as $optionDescription) {
153 if ($command->getDescription() !==
'') {
156 $descriptionLines = explode(chr(10), $command->getDescription());
157 foreach ($descriptionLines as $descriptionLine) {
158 $this->
outputLine(
'%-2s%s', array(
' ', $descriptionLine));
161 $relatedCommandIdentifiers = $command->getRelatedCommandIdentifiers();
162 if ($relatedCommandIdentifiers !== array()) {
165 foreach ($relatedCommandIdentifiers as $commandIdentifier) {
166 $command = $this->commandManager->getCommandByIdentifier($commandIdentifier);
167 $this->
outputLine(
'%-2s%s (%s)', array(
' ', $commandIdentifier, $command->getShortDescription()));
182 if ($exception instanceof \
TYPO3\CMS\Extbase\Mvc\
Exception\AmbiguousCommandIdentifierException) {
183 $this->
outputLine(
'Please specify the complete command identifier. Matched commands:');
184 foreach ($exception->getMatchingCommands() as $matchingCommand) {
185 $this->
outputLine(
' %s', array($matchingCommand->getCommandIdentifier()));
189 $this->
outputLine(
'Enter "' . $this->request->getCallingScript() .
' help" for an overview of all available commands');
190 $this->
outputLine(
'or "' . $this->request->getCallingScript() .
' help <command identifier>" for a detailed description of the corresponding command.');
200 $availableCommands = $this->commandManager->getAvailableCommands();
201 foreach ($availableCommands as $command) {
202 if ($command->isInternal()) {
205 $commandIdentifier = $command->getCommandIdentifier();
206 $extensionKey = strstr($commandIdentifier,
':', TRUE);
207 $commandControllerClassName = $command->getControllerClassName();
208 $commandName = $command->getControllerCommandName();
209 $this->commandsByExtensionsAndControllers[$extensionKey][$commandControllerClassName][$commandName] = $command;
errorCommand(\TYPO3\CMS\Extbase\Mvc\Exception\CommandException $exception)
helpCommand($commandIdentifier=NULL)
displayHelpForCommand(\TYPO3\CMS\Extbase\Mvc\Cli\Command $command)
outputLine($text='', array $arguments=array())
$commandsByExtensionsAndControllers