2 namespace TYPO3\CMS\Extbase\Command;
53 $this->
outputLine(
'Extbase %s', array(\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::getExtensionVersion(
'extbase')));
54 $this->
outputLine(
'usage: ' . $this->request->getCallingScript() .
' <command identifier>');
56 $this->
outputLine(
'See \'' . $this->request->getCallingScript() .
' help\' for a list of all available commands.');
71 if ($commandIdentifier === null) {
75 $command = $this->commandManager->getCommandByIdentifier($commandIdentifier);
76 }
catch (\TYPO3\CMS\Extbase\Mvc\
Exception\CommandException $exception) {
90 $this->
outputLine(
'Extbase %s', array(\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::getExtensionVersion(
'extbase')));
91 $this->
outputLine(
'usage: ' . $this->request->getCallingScript() .
' <command identifier>');
93 $this->
outputLine(
'The following commands are currently available:');
94 foreach ($this->commandsByExtensionsAndControllers as $extensionKey => $commandControllers) {
96 $this->
outputLine(
'EXTENSION "%s":', array(strtoupper($extensionKey)));
98 foreach ($commandControllers as $commands) {
99 foreach ($commands as $command) {
100 $description = wordwrap($command->getShortDescription(), $this->
output->getMaximumLineLength() - 43, PHP_EOL . str_repeat(
' ', 43),
true);
101 $shortCommandIdentifier = $this->commandManager->getShortestIdentifierForCommand($command);
102 $this->
outputLine(
'%-2s%-40s %s', array(
' ', $shortCommandIdentifier, $description));
107 $this->
outputLine(
'See \'' . $this->request->getCallingScript() .
' help <command identifier>\' for more information about a specific command.');
120 $this->
outputLine($command->getShortDescription());
123 $this->
outputLine(
'%-2s%s', array(
' ', $command->getCommandIdentifier()));
124 $commandArgumentDefinitions = $command->getArgumentDefinitions();
127 foreach ($commandArgumentDefinitions as $commandArgumentDefinition) {
128 if (!$commandArgumentDefinition->isRequired()) {
131 $usage .= sprintf(
' <%s>', strtolower(preg_replace(
'/([A-Z])/',
' $1', $commandArgumentDefinition->getName())));
134 $usage = $this->request->getCallingScript() .
' ' . $this->commandManager->getShortestIdentifierForCommand($command) . ($hasOptions ?
' [<options>]' :
'') . $usage;
138 $argumentDescriptions = array();
139 $optionDescriptions = array();
140 if ($command->hasArguments()) {
141 foreach ($commandArgumentDefinitions as $commandArgumentDefinition) {
142 $argumentDescription = $commandArgumentDefinition->getDescription();
143 $argumentDescription = wordwrap($argumentDescription, $this->
output->getMaximumLineLength() - 23, PHP_EOL . str_repeat(
' ', 23),
true);
144 if ($commandArgumentDefinition->isRequired()) {
145 $argumentDescriptions[] = vsprintf(
' %-20s %s', array($commandArgumentDefinition->getDashedName(), $argumentDescription));
147 $optionDescriptions[] = vsprintf(
' %-20s %s', array($commandArgumentDefinition->getDashedName(), $argumentDescription));
151 if (!empty($argumentDescriptions)) {
154 foreach ($argumentDescriptions as $argumentDescription) {
158 if (!empty($optionDescriptions)) {
161 foreach ($optionDescriptions as $optionDescription) {
165 if ($command->getDescription() !==
'') {
168 $descriptionLines = explode(LF, $command->getDescription());
169 foreach ($descriptionLines as $descriptionLine) {
170 $this->
outputLine(
'%-2s%s', array(
' ', $descriptionLine));
173 $relatedCommandIdentifiers = $command->getRelatedCommandIdentifiers();
174 if ($relatedCommandIdentifiers !== array()) {
177 foreach ($relatedCommandIdentifiers as $commandIdentifier) {
178 $command = $this->commandManager->getCommandByIdentifier($commandIdentifier);
179 $this->
outputLine(
'%-2s%s (%s)', array(
' ', $commandIdentifier, $command->getShortDescription()));
195 if ($exception instanceof \TYPO3\CMS\Extbase\Mvc\
Exception\AmbiguousCommandIdentifierException) {
196 $this->
outputLine(
'Please specify the complete command identifier. Matched commands:');
197 foreach ($exception->getMatchingCommands() as $matchingCommand) {
198 $this->
outputLine(
' %s', array($matchingCommand->getCommandIdentifier()));
202 $this->
outputLine(
'Enter "' . $this->request->getCallingScript() .
' help" for an overview of all available commands');
203 $this->
outputLine(
'or "' . $this->request->getCallingScript() .
' help <command identifier>" for a detailed description of the corresponding command.');
214 $availableCommands = $this->commandManager->getAvailableCommands();
215 foreach ($availableCommands as $command) {
216 if ($command->isInternal()) {
219 $commandIdentifier = $command->getCommandIdentifier();
220 $extensionKey = strstr($commandIdentifier,
':',
true);
221 $commandControllerClassName = $command->getControllerClassName();
222 $commandName = $command->getControllerCommandName();
223 $this->commandsByExtensionsAndControllers[$extensionKey][$commandControllerClassName][$commandName] = $command;