Updating vendors

skala
Julio Montoya 12 years ago
parent 0df0c967a9
commit 3dd9d88e31
  1. 2
      vendor/autoload.php
  2. 12
      vendor/chamilo/chash/composer.json
  3. 38
      vendor/chamilo/chash/composer.lock
  4. 14
      vendor/chamilo/chash/src/Chash/Command/Database/CommonChamiloDatabaseCommand.php
  5. 14
      vendor/chamilo/chash/src/Chash/Command/Database/DropDatabaseCommand.php
  6. 10
      vendor/chamilo/chash/src/Chash/Command/Database/DumpCommand.php
  7. 10
      vendor/chamilo/chash/src/Chash/Command/Database/FullBackupCommand.php
  8. 10
      vendor/chamilo/chash/src/Chash/Command/Database/RestoreCommand.php
  9. 10
      vendor/chamilo/chash/src/Chash/Command/Database/RunSQLCommand.php
  10. 10
      vendor/chamilo/chash/src/Chash/Command/Database/SQLCountCommand.php
  11. 12
      vendor/chamilo/chash/src/Chash/Command/Database/ShowConnInfoCommand.php
  12. 9
      vendor/chamilo/chash/src/Chash/Command/Files/CleanConfigFiles.php
  13. 10
      vendor/chamilo/chash/src/Chash/Command/Files/CleanTempFolderCommand.php
  14. 10
      vendor/chamilo/chash/src/Chash/Command/Files/MailConfCommand.php
  15. 7
      vendor/chamilo/chash/src/Chash/Command/Translation/AddSubLanguageCommand.php
  16. 7
      vendor/chamilo/chash/src/Chash/Command/Translation/DisableLanguageCommand.php
  17. 10
      vendor/chamilo/chash/src/Chash/Command/Translation/EnableLanguageCommand.php
  18. 14
      vendor/chamilo/chash/src/Chash/Command/Translation/ExportLanguageCommand.php
  19. 14
      vendor/chamilo/chash/src/Chash/Command/Translation/ImportLanguageCommand.php
  20. 7
      vendor/chamilo/chash/src/Chash/Command/Translation/ListLanguagesCommand.php
  21. 10
      vendor/chamilo/chash/src/Chash/Command/Translation/PlatformLanguageCommand.php
  22. 13
      vendor/chamilo/chash/src/Chash/Command/User/ChangePassCommand.php
  23. 12
      vendor/chamilo/chash/src/Chash/Command/User/CommonChamiloUserCommand.php
  24. 15
      vendor/chamilo/chash/src/Chash/Command/User/DisableAdminsCommand.php
  25. 9
      vendor/chamilo/chash/src/Chash/Command/User/ResetLoginCommand.php
  26. 9
      vendor/chamilo/chash/src/Chash/Command/User/SetLanguageCommand.php
  27. 20
      vendor/chamilo/chash/src/Chash/Helpers/ConfigurationHelper.php
  28. 2
      vendor/chamilo/chash/vendor/autoload.php
  29. 36
      vendor/chamilo/chash/vendor/composer/ClassLoader.php
  30. 6
      vendor/chamilo/chash/vendor/composer/autoload_namespaces.php
  31. 8
      vendor/chamilo/chash/vendor/composer/autoload_real.php
  32. 56
      vendor/chamilo/chash/vendor/composer/installed.json
  33. 222
      vendor/chamilo/chash/vendor/symfony/console/Symfony/Component/Console/Application.php
  34. 3
      vendor/chamilo/chash/vendor/symfony/console/Symfony/Component/Console/CHANGELOG.md
  35. 81
      vendor/chamilo/chash/vendor/symfony/console/Symfony/Component/Console/Command/Command.php
  36. 14
      vendor/chamilo/chash/vendor/symfony/console/Symfony/Component/Console/Command/HelpCommand.php
  37. 21
      vendor/chamilo/chash/vendor/symfony/console/Symfony/Component/Console/Command/ListCommand.php
  38. 2
      vendor/chamilo/chash/vendor/symfony/console/Symfony/Component/Console/ConsoleEvents.php
  39. 153
      vendor/chamilo/chash/vendor/symfony/console/Symfony/Component/Console/Descriptor/ApplicationDescription.php
  40. 92
      vendor/chamilo/chash/vendor/symfony/console/Symfony/Component/Console/Descriptor/Descriptor.php
  41. 30
      vendor/chamilo/chash/vendor/symfony/console/Symfony/Component/Console/Descriptor/DescriptorInterface.php
  42. 129
      vendor/chamilo/chash/vendor/symfony/console/Symfony/Component/Console/Descriptor/JsonDescriptor.php
  43. 129
      vendor/chamilo/chash/vendor/symfony/console/Symfony/Component/Console/Descriptor/MarkdownDescriptor.php
  44. 210
      vendor/chamilo/chash/vendor/symfony/console/Symfony/Component/Console/Descriptor/TextDescriptor.php
  45. 212
      vendor/chamilo/chash/vendor/symfony/console/Symfony/Component/Console/Descriptor/XmlDescriptor.php
  46. 4
      vendor/chamilo/chash/vendor/symfony/console/Symfony/Component/Console/Event/ConsoleCommandEvent.php
  47. 67
      vendor/chamilo/chash/vendor/symfony/console/Symfony/Component/Console/Event/ConsoleExceptionEvent.php
  48. 2
      vendor/chamilo/chash/vendor/symfony/console/Symfony/Component/Console/Event/ConsoleTerminateEvent.php
  49. 2
      vendor/chamilo/chash/vendor/symfony/console/Symfony/Component/Console/Formatter/OutputFormatter.php
  50. 95
      vendor/chamilo/chash/vendor/symfony/console/Symfony/Component/Console/Helper/DescriptorHelper.php
  51. 37
      vendor/chamilo/chash/vendor/symfony/console/Symfony/Component/Console/Helper/DialogHelper.php
  52. 16
      vendor/chamilo/chash/vendor/symfony/console/Symfony/Component/Console/Helper/ProgressHelper.php
  53. 9
      vendor/chamilo/chash/vendor/symfony/console/Symfony/Component/Console/Input/ArgvInput.php
  54. 142
      vendor/chamilo/chash/vendor/symfony/console/Symfony/Component/Console/Input/InputDefinition.php
  55. 17
      vendor/chamilo/chash/vendor/symfony/console/Symfony/Component/Console/Input/InputOption.php
  56. 21
      vendor/chamilo/chash/vendor/symfony/console/Symfony/Component/Console/Output/ConsoleOutput.php
  57. 7
      vendor/chamilo/chash/vendor/symfony/console/Symfony/Component/Console/Output/ConsoleOutputInterface.php
  58. 71
      vendor/chamilo/chash/vendor/symfony/console/Symfony/Component/Console/Output/NullOutput.php
  59. 77
      vendor/chamilo/chash/vendor/symfony/console/Symfony/Component/Console/Output/Output.php
  60. 30
      vendor/chamilo/chash/vendor/symfony/console/Symfony/Component/Console/Output/OutputInterface.php
  61. 16
      vendor/chamilo/chash/vendor/symfony/console/Symfony/Component/Console/Output/StreamOutput.php
  62. 27
      vendor/chamilo/chash/vendor/symfony/console/Symfony/Component/Console/Shell.php
  63. 13
      vendor/chamilo/chash/vendor/symfony/console/Symfony/Component/Console/Tester/ApplicationTester.php
  64. 13
      vendor/chamilo/chash/vendor/symfony/console/Symfony/Component/Console/Tester/CommandTester.php
  65. 74
      vendor/chamilo/chash/vendor/symfony/console/Symfony/Component/Console/Tests/ApplicationTest.php
  66. 37
      vendor/chamilo/chash/vendor/symfony/console/Symfony/Component/Console/Tests/Command/CommandTest.php
  67. 19
      vendor/chamilo/chash/vendor/symfony/console/Symfony/Component/Console/Tests/Command/HelpCommandTest.php
  68. 21
      vendor/chamilo/chash/vendor/symfony/console/Symfony/Component/Console/Tests/Command/ListCommandTest.php
  69. 98
      vendor/chamilo/chash/vendor/symfony/console/Symfony/Component/Console/Tests/Descriptor/AbstractDescriptorTest.php
  70. 27
      vendor/chamilo/chash/vendor/symfony/console/Symfony/Component/Console/Tests/Descriptor/JsonDescriptorTest.php
  71. 27
      vendor/chamilo/chash/vendor/symfony/console/Symfony/Component/Console/Tests/Descriptor/MarkdownDescriptorTest.php
  72. 75
      vendor/chamilo/chash/vendor/symfony/console/Symfony/Component/Console/Tests/Descriptor/ObjectsProvider.php
  73. 27
      vendor/chamilo/chash/vendor/symfony/console/Symfony/Component/Console/Tests/Descriptor/TextDescriptorTest.php
  74. 27
      vendor/chamilo/chash/vendor/symfony/console/Symfony/Component/Console/Tests/Descriptor/XmlDescriptorTest.php
  75. 18
      vendor/chamilo/chash/vendor/symfony/console/Symfony/Component/Console/Tests/Fixtures/DescriptorApplication1.php
  76. 24
      vendor/chamilo/chash/vendor/symfony/console/Symfony/Component/Console/Tests/Fixtures/DescriptorApplication2.php
  77. 27
      vendor/chamilo/chash/vendor/symfony/console/Symfony/Component/Console/Tests/Fixtures/DescriptorCommand1.php
  78. 30
      vendor/chamilo/chash/vendor/symfony/console/Symfony/Component/Console/Tests/Fixtures/DescriptorCommand2.php
  79. 1
      vendor/chamilo/chash/vendor/symfony/console/Symfony/Component/Console/Tests/Fixtures/application_1.json
  80. 199
      vendor/chamilo/chash/vendor/symfony/console/Symfony/Component/Console/Tests/Fixtures/application_1.md
  81. 17
      vendor/chamilo/chash/vendor/symfony/console/Symfony/Component/Console/Tests/Fixtures/application_1.txt
  82. 104
      vendor/chamilo/chash/vendor/symfony/console/Symfony/Component/Console/Tests/Fixtures/application_1.xml
  83. 1
      vendor/chamilo/chash/vendor/symfony/console/Symfony/Component/Console/Tests/Fixtures/application_2.json
  84. 388
      vendor/chamilo/chash/vendor/symfony/console/Symfony/Component/Console/Tests/Fixtures/application_2.md
  85. 22
      vendor/chamilo/chash/vendor/symfony/console/Symfony/Component/Console/Tests/Fixtures/application_2.txt
  86. 181
      vendor/chamilo/chash/vendor/symfony/console/Symfony/Component/Console/Tests/Fixtures/application_2.xml
  87. 2
      vendor/chamilo/chash/vendor/symfony/console/Symfony/Component/Console/Tests/Fixtures/application_astext1.txt
  88. 2
      vendor/chamilo/chash/vendor/symfony/console/Symfony/Component/Console/Tests/Fixtures/application_astext2.txt
  89. 34
      vendor/chamilo/chash/vendor/symfony/console/Symfony/Component/Console/Tests/Fixtures/application_asxml1.txt
  90. 4
      vendor/chamilo/chash/vendor/symfony/console/Symfony/Component/Console/Tests/Fixtures/application_asxml2.txt
  91. 2
      vendor/chamilo/chash/vendor/symfony/console/Symfony/Component/Console/Tests/Fixtures/application_gethelp.txt
  92. 2
      vendor/chamilo/chash/vendor/symfony/console/Symfony/Component/Console/Tests/Fixtures/application_renderexception2.txt
  93. 2
      vendor/chamilo/chash/vendor/symfony/console/Symfony/Component/Console/Tests/Fixtures/application_run1.txt
  94. 10
      vendor/chamilo/chash/vendor/symfony/console/Symfony/Component/Console/Tests/Fixtures/application_run2.txt
  95. 9
      vendor/chamilo/chash/vendor/symfony/console/Symfony/Component/Console/Tests/Fixtures/application_run3.txt
  96. 1
      vendor/chamilo/chash/vendor/symfony/console/Symfony/Component/Console/Tests/Fixtures/command_1.json
  97. 8
      vendor/chamilo/chash/vendor/symfony/console/Symfony/Component/Console/Tests/Fixtures/command_1.md
  98. 7
      vendor/chamilo/chash/vendor/symfony/console/Symfony/Component/Console/Tests/Fixtures/command_1.txt
  99. 12
      vendor/chamilo/chash/vendor/symfony/console/Symfony/Component/Console/Tests/Fixtures/command_1.xml
  100. 1
      vendor/chamilo/chash/vendor/symfony/console/Symfony/Component/Console/Tests/Fixtures/command_2.json
  101. Some files were not shown because too many files have changed in this diff Show More

@ -4,4 +4,4 @@
require_once __DIR__ . '/composer' . '/autoload_real.php';
return ComposerAutoloaderInitb649ef0227f3a7d18810b5f05a8e12b9::getLoader();
return ComposerAutoloaderInitf1570b8e88fdf1324432ee8cce6f1eed::getLoader();

@ -1,5 +1,11 @@
{
"name": "chamilo/chash",
"type": "library",
"homepage": "http://www.chamilo.org",
"support": {
"forum": "http://www.chamilo.org/forum",
"irc": "irc://irc.freenode.org/chamilo"
},
"autoload": {
"psr-0": {
"Chash": "src/"
@ -7,8 +13,8 @@
},
"require": {
"php": ">=5.3.2",
"symfony/console": "2.3.*@dev",
"symfony/yaml" : "2.1.*"
"symfony/console": "~2.3",
"symfony/yaml" : "~2.3"
},
"minimum-stability": "dev"
}
}

@ -3,7 +3,7 @@
"This file locks the dependencies of your project to a known state",
"Read more about it at http://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file"
],
"hash": "1bea5cc52d392819dc48a5b9caa6a96b",
"hash": "821d09d18496b569c8eede1ef8903d84",
"packages": [
{
"name": "symfony/console",
@ -12,12 +12,12 @@
"source": {
"type": "git",
"url": "https://github.com/symfony/Console.git",
"reference": "74049e36e2e73ca2ec069c9be86d01ba422d44ea"
"reference": "699ccfc18fff7912c08021de878477f0724850b3"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/Console/zipball/74049e36e2e73ca2ec069c9be86d01ba422d44ea",
"reference": "74049e36e2e73ca2ec069c9be86d01ba422d44ea",
"url": "https://api.github.com/repos/symfony/Console/zipball/699ccfc18fff7912c08021de878477f0724850b3",
"reference": "699ccfc18fff7912c08021de878477f0724850b3",
"shasum": ""
},
"require": {
@ -26,10 +26,13 @@
"require-dev": {
"symfony/event-dispatcher": ">=2.1,<3.0"
},
"suggest": {
"symfony/event-dispatcher": ""
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "2.3-dev"
"dev-master": "2.4-dev"
}
},
"autoload": {
@ -53,30 +56,35 @@
],
"description": "Symfony Console Component",
"homepage": "http://symfony.com",
"time": "2013-04-13 14:06:01"
"time": "2013-06-11 07:15:38"
},
{
"name": "symfony/yaml",
"version": "2.1.x-dev",
"version": "dev-master",
"target-dir": "Symfony/Component/Yaml",
"source": {
"type": "git",
"url": "https://github.com/symfony/Yaml.git",
"reference": "4ef80f5c5081ad9a7e08184fc9f25c62d87e408c"
"reference": "82100c7732c95452702d11433aad50988700d36c"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/Yaml/zipball/4ef80f5c5081ad9a7e08184fc9f25c62d87e408c",
"reference": "4ef80f5c5081ad9a7e08184fc9f25c62d87e408c",
"url": "https://api.github.com/repos/symfony/Yaml/zipball/82100c7732c95452702d11433aad50988700d36c",
"reference": "82100c7732c95452702d11433aad50988700d36c",
"shasum": ""
},
"require": {
"php": ">=5.3.3"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "2.4-dev"
}
},
"autoload": {
"psr-0": {
"Symfony\\Component\\Yaml": ""
"Symfony\\Component\\Yaml\\": ""
}
},
"notification-url": "https://packagist.org/downloads/",
@ -95,7 +103,7 @@
],
"description": "Symfony Yaml Component",
"homepage": "http://symfony.com",
"time": "2013-04-12 10:27:36"
"time": "2013-05-16 07:54:39"
}
],
"packages-dev": [
@ -105,9 +113,9 @@
],
"minimum-stability": "dev",
"stability-flags": {
"symfony/console": 20
},
"stability-flags": [
],
"platform": {
"php": ">=5.3.2"
},

@ -10,8 +10,15 @@ use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Formatter\OutputFormatterStyle;
/**
* Class CommonChamiloDatabaseCommand
* @package Chash\Command\Database
*/
class CommonChamiloDatabaseCommand extends Command
{
/**
*
*/
protected function configure()
{
$this
@ -23,9 +30,14 @@ class CommonChamiloDatabaseCommand extends Command
);
}
/**
* @param InputInterface $input
* @param OutputInterface $output
* @return int|null|void
*/
protected function execute(InputInterface $input, OutputInterface $output)
{
$configuration = $input->getOption('conf');
$this->getHelper('configuration')->readConfigurationFile($configuration);
}
}
}

@ -8,8 +8,15 @@ use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;
/**
* Class DropDatabaseCommand
* @package Chash\Command\Database
*/
class DropDatabaseCommand extends CommonChamiloDatabaseCommand
{
/**
*
*/
protected function configure()
{
parent::configure();
@ -19,6 +26,11 @@ class DropDatabaseCommand extends CommonChamiloDatabaseCommand
->setDescription('Drops all databases from the current Chamilo install');
}
/**
* @param InputInterface $input
* @param OutputInterface $output
* @return int|null|void
*/
protected function execute(InputInterface $input, OutputInterface $output)
{
parent::execute($input, $output);
@ -62,4 +74,4 @@ class DropDatabaseCommand extends CommonChamiloDatabaseCommand
$output->writeln("<comment>Can't stablished connection with the database</comment>");
}
}
}
}

@ -19,6 +19,9 @@ use Symfony\Component\Console\Output\OutputInterface;
*/
class DumpCommand extends CommonChamiloDatabaseCommand
{
/**
*
*/
protected function configure()
{
parent::configure();
@ -28,6 +31,11 @@ class DumpCommand extends CommonChamiloDatabaseCommand
->setDescription('Outputs a dump of the database');
}
/**
* @param InputInterface $input
* @param OutputInterface $output
* @return int|null|void
*/
protected function execute(InputInterface $input, OutputInterface $output)
{
parent::execute($input, $output);
@ -36,4 +44,4 @@ class DumpCommand extends CommonChamiloDatabaseCommand
system($dump);
return null;
}
}
}

@ -15,6 +15,9 @@ use Symfony\Component\Console\Input\ArrayInput;
*/
class FullBackupCommand extends CommonChamiloDatabaseCommand
{
/**
*
*/
protected function configure()
{
parent::configure();
@ -45,6 +48,11 @@ class FullBackupCommand extends CommonChamiloDatabaseCommand
);
}
/**
* @param InputInterface $input
* @param OutputInterface $output
* @return int|null|void
*/
protected function execute(InputInterface $input, OutputInterface $output)
{
parent::execute($input, $output);
@ -103,4 +111,4 @@ class FullBackupCommand extends CommonChamiloDatabaseCommand
);
}
}
}

@ -15,6 +15,9 @@ use Symfony\Component\Console\Output\OutputInterface;
*/
class RestoreCommand extends CommonChamiloDatabaseCommand
{
/**
*
*/
protected function configure()
{
parent::configure();
@ -31,6 +34,11 @@ class RestoreCommand extends CommonChamiloDatabaseCommand
);
}
/**
* @param InputInterface $input
* @param OutputInterface $output
* @return int|null|void
*/
protected function execute(InputInterface $input, OutputInterface $output)
{
parent::execute($input, $output);
@ -46,4 +54,4 @@ class RestoreCommand extends CommonChamiloDatabaseCommand
$output->writeln('<comment>File is not a valid SQL file: '.$dumpPath.' </comment>');
}
}
}
}

@ -16,6 +16,9 @@ use Symfony\Component\Console\Formatter\OutputFormatterStyle;
*/
class RunSQLCommand extends CommonChamiloDatabaseCommand
{
/**
*
*/
protected function configure()
{
parent::configure();
@ -27,6 +30,11 @@ class RunSQLCommand extends CommonChamiloDatabaseCommand
}
/**
* @param InputInterface $input
* @param OutputInterface $output
* @return int|null|void
*/
protected function execute(InputInterface $input, OutputInterface $output)
{
parent::execute($input, $output);
@ -60,4 +68,4 @@ class RunSQLCommand extends CommonChamiloDatabaseCommand
//$output->getFormatter()->setStyle('fcbarcelona', new OutputFormatterStyle('red', 'blue', array('blink', 'bold', 'underscore')));
//$output->writeln('<fcbarcelona>Messi for the win</fcbarcelona>');
}
}
}

@ -14,6 +14,9 @@ use Symfony\Component\Console\Output\OutputInterface;
*/
class SQLCountCommand extends CommonChamiloDatabaseCommand
{
/**
*
*/
protected function configure()
{
parent::configure();
@ -27,6 +30,11 @@ class SQLCountCommand extends CommonChamiloDatabaseCommand
);
}
/**
* @param InputInterface $input
* @param OutputInterface $output
* @return int|null|void
*/
protected function execute(InputInterface $input, OutputInterface $output)
{
parent::execute($input, $output);
@ -48,4 +56,4 @@ class SQLCountCommand extends CommonChamiloDatabaseCommand
);
}
}
}
}

@ -8,8 +8,15 @@ use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;
/**
* Class ShowConnInfoCommand
* @package Chash\Command\Database
*/
class ShowConnInfoCommand extends CommonChamiloDatabaseCommand
{
/**
*
*/
protected function configure()
{
parent::configure();
@ -19,6 +26,11 @@ class ShowConnInfoCommand extends CommonChamiloDatabaseCommand
->setDescription('Shows database connection credentials for the current Chamilo install');
}
/**
* @param InputInterface $input
* @param OutputInterface $output
* @return int|null|void
*/
protected function execute(InputInterface $input, OutputInterface $output)
{
parent::execute($input, $output);

@ -13,9 +13,11 @@ use Symfony\Component\Console\Output\OutputInterface;
* Clean the archives directory, leaving only index.html, twig and Serializer
* @return bool True on success, false on error
*/
class CleanConfigFiles extends CommonChamiloDatabaseCommand
{
/**
*
*/
protected function configure()
{
parent::configure();
@ -24,6 +26,11 @@ class CleanConfigFiles extends CommonChamiloDatabaseCommand
->setDescription('Cleans the config files to help you re-install');
}
/**
* @param InputInterface $input
* @param OutputInterface $output
* @return int|null|void
*/
protected function execute(InputInterface $input, OutputInterface $output)
{
parent::execute($input, $output);

@ -16,6 +16,9 @@ use Symfony\Component\Console\Output\OutputInterface;
class CleanTempFolderCommand extends CommonChamiloDatabaseCommand
{
/**
*
*/
protected function configure()
{
parent::configure();
@ -24,6 +27,11 @@ class CleanTempFolderCommand extends CommonChamiloDatabaseCommand
->setDescription('Cleans the archives directory');
}
/**
* @param InputInterface $input
* @param OutputInterface $output
* @return bool|int|null|void
*/
protected function execute(InputInterface $input, OutputInterface $output)
{
parent::execute($input, $output);
@ -66,4 +74,4 @@ class CleanTempFolderCommand extends CommonChamiloDatabaseCommand
}
$output->writeln('<info>Files were cleaned</info>');
}
}
}

@ -10,10 +10,13 @@ use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;
/**
* Returns the current mail configuration
* Returns the current mail configuration
*/
class MailConfCommand extends CommonChamiloDatabaseCommand
{
/**
*
*/
protected function configure()
{
parent::configure();
@ -22,6 +25,11 @@ class MailConfCommand extends CommonChamiloDatabaseCommand
->setDescription('Returns the current mail config');
}
/**
* @param InputInterface $input
* @param OutputInterface $output
* @return int|null|void
*/
protected function execute(InputInterface $input, OutputInterface $output)
{
parent::execute($input, $output);

@ -17,7 +17,9 @@ use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;
/**
* Class AddSubLanguageCommand
* Definition of the translation:add_sub_language command
* @package Chash\Command\Translation
*/
class AddSubLanguageCommand extends CommonChamiloDatabaseCommand
{
@ -40,6 +42,11 @@ class AddSubLanguageCommand extends CommonChamiloDatabaseCommand
);
}
/**
* @param InputInterface $input
* @param OutputInterface $output
* @return int|null|void
*/
protected function execute(InputInterface $input, OutputInterface $output)
{
parent::execute($input, $output);

@ -17,7 +17,9 @@ use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;
/**
* Class DisableLanguageCommand
* Definition of the translation:disable command
* @package Chash\Command\Translation
*/
class DisableLanguageCommand extends CommonChamiloDatabaseCommand
{
@ -35,6 +37,11 @@ class DisableLanguageCommand extends CommonChamiloDatabaseCommand
);
}
/**
* @param InputInterface $input
* @param OutputInterface $output
* @return int|null|void
*/
protected function execute(InputInterface $input, OutputInterface $output)
{
parent::execute($input, $output);

@ -17,10 +17,15 @@ use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;
/**
* Class EnableLanguageCommand
* Definition of the translation:enable command
* @package Chash\Command\Translation
*/
class EnableLanguageCommand extends CommonChamiloDatabaseCommand
{
/**
*
*/
protected function configure()
{
parent::configure();
@ -35,6 +40,11 @@ class EnableLanguageCommand extends CommonChamiloDatabaseCommand
);
}
/**
* @param InputInterface $input
* @param OutputInterface $output
* @return int|null|void
*/
protected function execute(InputInterface $input, OutputInterface $output)
{
parent::execute($input, $output);

@ -9,8 +9,15 @@ use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;
/**
* Class ExportLanguageCommand
* @package Chash\Command\Translation
*/
class ExportLanguageCommand extends CommonChamiloDatabaseCommand
{
/**
*
*/
protected function configure()
{
parent::configure();
@ -30,6 +37,11 @@ class ExportLanguageCommand extends CommonChamiloDatabaseCommand
);
}
/**
* @param InputInterface $input
* @param OutputInterface $output
* @return int|null|void
*/
protected function execute(InputInterface $input, OutputInterface $output)
{
parent::execute($input, $output);
@ -104,4 +116,4 @@ class ExportLanguageCommand extends CommonChamiloDatabaseCommand
}
}
}
}
}

@ -9,8 +9,15 @@ use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;
/**
* Class ImportLanguageCommand
* @package Chash\Command\Translation
*/
class ImportLanguageCommand extends CommonChamiloDatabaseCommand
{
/**
*
*/
protected function configure()
{
parent::configure();
@ -24,6 +31,11 @@ class ImportLanguageCommand extends CommonChamiloDatabaseCommand
);
}
/**
* @param InputInterface $input
* @param OutputInterface $output
* @return int|null|void
*/
protected function execute(InputInterface $input, OutputInterface $output)
{
parent::execute($input, $output);
@ -132,4 +144,4 @@ class ImportLanguageCommand extends CommonChamiloDatabaseCommand
}
}
}
}

@ -17,7 +17,9 @@ use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;
/**
* Class ListLanguagesCommand
* Definition of the translation:list command
* @package Chash\Command\Translation
*/
class ListLanguagesCommand extends CommonChamiloDatabaseCommand
{
@ -35,6 +37,11 @@ class ListLanguagesCommand extends CommonChamiloDatabaseCommand
);
}
/**
* @param InputInterface $input
* @param OutputInterface $output
* @return int|null|void
*/
protected function execute(InputInterface $input, OutputInterface $output)
{
parent::execute($input, $output);

@ -17,10 +17,15 @@ use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;
/**
* Class PlatformLanguageCommand
* Definition of the translation:platform_language command
* @package Chash\Command\Translation
*/
class PlatformLanguageCommand extends CommonChamiloDatabaseCommand
{
/**
*
*/
protected function configure()
{
parent::configure();
@ -35,6 +40,11 @@ class PlatformLanguageCommand extends CommonChamiloDatabaseCommand
);
}
/**
* @param InputInterface $input
* @param OutputInterface $output
* @return int|null|void
*/
protected function execute(InputInterface $input, OutputInterface $output)
{
parent::execute($input, $output);

@ -14,7 +14,9 @@ use Symfony\Component\Console\Output\OutputInterface;
* it for.
*/
/**
* Changes a user password to the one given
* Class ChangePassCommand
* Changes a user password to the one given
* @package Chash\Command\User
*/
class ChangePassCommand extends CommonChamiloUserCommand
{
@ -26,17 +28,22 @@ class ChangePassCommand extends CommonChamiloUserCommand
->setName('user:change_pass')
->setDescription('Updates the user password to the one given')
->addArgument(
'username',
'username',
InputArgument::REQUIRED,
'Allows you to specify the username'
)
->addArgument(
'password',
'password',
InputArgument::REQUIRED,
'The new password to give this user'
);
}
/**
* @param InputInterface $input
* @param OutputInterface $output
* @return null|void
*/
protected function execute(InputInterface $input, OutputInterface $output)
{
parent::execute($input, $output);

@ -10,8 +10,15 @@ use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Formatter\OutputFormatterStyle;
/**
* Class CommonChamiloUserCommand
* @package Chash\Command\User
*/
class CommonChamiloUserCommand extends Command
{
/**
*
*/
protected function configure()
{
$this
@ -23,6 +30,11 @@ class CommonChamiloUserCommand extends Command
);
}
/**
* @param InputInterface $input
* @param OutputInterface $output
* @return int|null|void
*/
protected function execute(InputInterface $input, OutputInterface $output)
{
$configuration = $input->getOption('conf');

@ -8,16 +8,16 @@ use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;
/**
* Command functions meant to deal with what the user of this script is calling
* it for.
*/
/**
* Class DisableAdminsCommand
* Remove the "admin" role from *ALL* users on all portals of this instance
* @package Chash\Command\User
*/
class DisableAdminsCommand extends CommonChamiloUserCommand
{
/**
*
*/
protected function configure()
{
parent::configure();
@ -27,6 +27,11 @@ class DisableAdminsCommand extends CommonChamiloUserCommand
->setDescription('Makes the given user admin on the main portal');
}
/**
* @param InputInterface $input
* @param OutputInterface $output
* @return int|null|void
*/
protected function execute(InputInterface $input, OutputInterface $output)
{
parent::execute($input, $output);

@ -14,8 +14,10 @@ use Symfony\Component\Console\Output\OutputInterface;
* it for.
*/
/**
* Class ResetLoginCommand
* Returns a password reset link for the given username (user will receive
* an e-mail with new login + password)
* @package Chash\Command\User
*/
class ResetLoginCommand extends CommonChamiloUserCommand
{
@ -27,12 +29,17 @@ class ResetLoginCommand extends CommonChamiloUserCommand
->setName('user:reset_login')
->setDescription('Outputs login link for given username')
->addArgument(
'username',
'username',
InputArgument::REQUIRED,
'Allows you to specify a username to login as'
);
}
/**
* @param InputInterface $input
* @param OutputInterface $output
* @return int|null|void
*/
protected function execute(InputInterface $input, OutputInterface $output)
{
parent::execute($input, $output);

@ -15,7 +15,9 @@ use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;
/**
* Class SetLanguageCommand
* Changes the language for all platform users
* @package Chash\Command\User
*/
class SetLanguageCommand extends CommonChamiloUserCommand
{
@ -28,12 +30,17 @@ class SetLanguageCommand extends CommonChamiloUserCommand
->setAliases(array('usl'))
->setDescription('Sets the users language to the one given')
->addArgument(
'language',
'language',
InputArgument::OPTIONAL,
'The English name for the new language to set all users to'
);
}
/**
* @param InputInterface $input
* @param OutputInterface $output
* @return int|null|void
*/
protected function execute(InputInterface $input, OutputInterface $output)
{
parent::execute($input, $output);

@ -5,10 +5,17 @@ namespace Chash\Helpers;
use Symfony\Component\Console\Helper\Helper;
use Symfony\Component\Yaml\Parser;
/**
* Class ConfigurationHelper
* @package Chash\Helpers
*/
class ConfigurationHelper extends Helper
{
protected $configuration;
/**
*
*/
public function __construct()
{
@ -105,7 +112,7 @@ class ConfigurationHelper extends Helper
$yaml = new Parser();
$_configurationYML = $yaml->parse(file_get_contents($confYML));
if (isset($_configurationYML) && !empty($_configurationYML)) {
if (isset($_configuration) && !empty($_configuration) ) {
if (isset($_configuration) && !empty($_configuration)) {
$_configuration = array_merge($_configuration, $_configurationYML);
} else {
$_configuration = $_configurationYML;
@ -128,6 +135,9 @@ class ConfigurationHelper extends Helper
$this->configuration = $configuration;
}
/**
* @return array
*/
public function getConfigFiles()
{
$configFiles = array();
@ -190,7 +200,7 @@ class ConfigurationHelper extends Helper
* Gets an array with all the databases (particularly useful for Chamilo <1.9)
* @return mixed Array of databases
*/
function getAllDatabases()
public function getAllDatabases()
{
$_configuration = $this->getConfiguration();
$dbs = array();
@ -240,6 +250,9 @@ class ConfigurationHelper extends Helper
return $dbs;
}
/**
* @return array|bool|mixed
*/
public function getConfiguration()
{
if (empty($this->configuration)) {
@ -248,6 +261,9 @@ class ConfigurationHelper extends Helper
return $this->configuration;
}
/**
* @return string
*/
public function getName()
{
return 'configuration';

@ -4,4 +4,4 @@
require_once __DIR__ . '/composer' . '/autoload_real.php';
return ComposerAutoloaderInitb821c02752afe45d11b4bba36e3dd2a7::getLoader();
return ComposerAutoloaderInit409b883617bdb71bb83c3e7004fffcac::getLoader();

@ -49,7 +49,7 @@ class ClassLoader
public function getPrefixes()
{
return $this->prefixes;
return call_user_func_array('array_merge', $this->prefixes);
}
public function getFallbackDirs()
@ -98,19 +98,21 @@ class ClassLoader
return;
}
if (!isset($this->prefixes[$prefix])) {
$this->prefixes[$prefix] = (array) $paths;
$first = $prefix[0];
if (!isset($this->prefixes[$first][$prefix])) {
$this->prefixes[$first][$prefix] = (array) $paths;
return;
}
if ($prepend) {
$this->prefixes[$prefix] = array_merge(
$this->prefixes[$first][$prefix] = array_merge(
(array) $paths,
$this->prefixes[$prefix]
$this->prefixes[$first][$prefix]
);
} else {
$this->prefixes[$prefix] = array_merge(
$this->prefixes[$prefix],
$this->prefixes[$first][$prefix] = array_merge(
$this->prefixes[$first][$prefix],
(array) $paths
);
}
@ -129,7 +131,7 @@ class ClassLoader
return;
}
$this->prefixes[$prefix] = (array) $paths;
$this->prefixes[substr($prefix, 0, 1)][$prefix] = (array) $paths;
}
/**
@ -195,6 +197,7 @@ class ClassLoader
*/
public function findFile($class)
{
// work around for PHP 5.3.0 - 5.3.2 https://bugs.php.net/50731
if ('\\' == $class[0]) {
$class = substr($class, 1);
}
@ -205,7 +208,7 @@ class ClassLoader
if (false !== $pos = strrpos($class, '\\')) {
// namespaced class name
$classPath = str_replace('\\', DIRECTORY_SEPARATOR, substr($class, 0, $pos)) . DIRECTORY_SEPARATOR;
$classPath = strtr(substr($class, 0, $pos), '\\', DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR;
$className = substr($class, $pos + 1);
} else {
// PEAR-like class name
@ -213,13 +216,16 @@ class ClassLoader
$className = $class;
}
$classPath .= str_replace('_', DIRECTORY_SEPARATOR, $className) . '.php';
$classPath .= strtr($className, '_', DIRECTORY_SEPARATOR) . '.php';
foreach ($this->prefixes as $prefix => $dirs) {
if (0 === strpos($class, $prefix)) {
foreach ($dirs as $dir) {
if (file_exists($dir . DIRECTORY_SEPARATOR . $classPath)) {
return $dir . DIRECTORY_SEPARATOR . $classPath;
$first = $class[0];
if (isset($this->prefixes[$first])) {
foreach ($this->prefixes[$first] as $prefix => $dirs) {
if (0 === strpos($class, $prefix)) {
foreach ($dirs as $dir) {
if (file_exists($dir . DIRECTORY_SEPARATOR . $classPath)) {
return $dir . DIRECTORY_SEPARATOR . $classPath;
}
}
}
}

@ -6,7 +6,7 @@ $vendorDir = dirname(dirname(__FILE__));
$baseDir = dirname($vendorDir);
return array(
'Symfony\\Component\\Yaml' => $vendorDir . '/symfony/yaml',
'Symfony\\Component\\Console\\' => $vendorDir . '/symfony/console',
'Chash' => $baseDir . '/src',
'Symfony\\Component\\Yaml\\' => array($vendorDir . '/symfony/yaml'),
'Symfony\\Component\\Console\\' => array($vendorDir . '/symfony/console'),
'Chash' => array($baseDir . '/src'),
);

@ -2,7 +2,7 @@
// autoload_real.php generated by Composer
class ComposerAutoloaderInitb821c02752afe45d11b4bba36e3dd2a7
class ComposerAutoloaderInit409b883617bdb71bb83c3e7004fffcac
{
private static $loader;
@ -19,16 +19,16 @@ class ComposerAutoloaderInitb821c02752afe45d11b4bba36e3dd2a7
return self::$loader;
}
spl_autoload_register(array('ComposerAutoloaderInitb821c02752afe45d11b4bba36e3dd2a7', 'loadClassLoader'), true, true);
spl_autoload_register(array('ComposerAutoloaderInit409b883617bdb71bb83c3e7004fffcac', 'loadClassLoader'), true, true);
self::$loader = $loader = new \Composer\Autoload\ClassLoader();
spl_autoload_unregister(array('ComposerAutoloaderInitb821c02752afe45d11b4bba36e3dd2a7', 'loadClassLoader'));
spl_autoload_unregister(array('ComposerAutoloaderInit409b883617bdb71bb83c3e7004fffcac', 'loadClassLoader'));
$vendorDir = dirname(__DIR__);
$baseDir = dirname($vendorDir);
$map = require __DIR__ . '/autoload_namespaces.php';
foreach ($map as $namespace => $path) {
$loader->add($namespace, $path);
$loader->set($namespace, $path);
}
$classMap = require __DIR__ . '/autoload_classmap.php';

@ -1,29 +1,40 @@
[
{
"name": "symfony/yaml",
"version": "2.1.x-dev",
"version_normalized": "2.1.9999999.9999999-dev",
"target-dir": "Symfony/Component/Yaml",
"name": "symfony/console",
"version": "dev-master",
"version_normalized": "9999999-dev",
"target-dir": "Symfony/Component/Console",
"source": {
"type": "git",
"url": "https://github.com/symfony/Yaml.git",
"reference": "4ef80f5c5081ad9a7e08184fc9f25c62d87e408c"
"url": "https://github.com/symfony/Console.git",
"reference": "699ccfc18fff7912c08021de878477f0724850b3"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/Yaml/zipball/4ef80f5c5081ad9a7e08184fc9f25c62d87e408c",
"reference": "4ef80f5c5081ad9a7e08184fc9f25c62d87e408c",
"url": "https://api.github.com/repos/symfony/Console/zipball/699ccfc18fff7912c08021de878477f0724850b3",
"reference": "699ccfc18fff7912c08021de878477f0724850b3",
"shasum": ""
},
"require": {
"php": ">=5.3.3"
},
"time": "2013-04-12 10:27:36",
"require-dev": {
"symfony/event-dispatcher": ">=2.1,<3.0"
},
"suggest": {
"symfony/event-dispatcher": ""
},
"time": "2013-06-11 07:15:38",
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "2.4-dev"
}
},
"installation-source": "source",
"autoload": {
"psr-0": {
"Symfony\\Component\\Yaml": ""
"Symfony\\Component\\Console\\": ""
}
},
"notification-url": "https://packagist.org/downloads/",
@ -40,42 +51,39 @@
"homepage": "http://symfony.com/contributors"
}
],
"description": "Symfony Yaml Component",
"description": "Symfony Console Component",
"homepage": "http://symfony.com"
},
{
"name": "symfony/console",
"name": "symfony/yaml",
"version": "dev-master",
"version_normalized": "9999999-dev",
"target-dir": "Symfony/Component/Console",
"target-dir": "Symfony/Component/Yaml",
"source": {
"type": "git",
"url": "https://github.com/symfony/Console.git",
"reference": "74049e36e2e73ca2ec069c9be86d01ba422d44ea"
"url": "https://github.com/symfony/Yaml.git",
"reference": "82100c7732c95452702d11433aad50988700d36c"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/Console/zipball/74049e36e2e73ca2ec069c9be86d01ba422d44ea",
"reference": "74049e36e2e73ca2ec069c9be86d01ba422d44ea",
"url": "https://api.github.com/repos/symfony/Yaml/zipball/82100c7732c95452702d11433aad50988700d36c",
"reference": "82100c7732c95452702d11433aad50988700d36c",
"shasum": ""
},
"require": {
"php": ">=5.3.3"
},
"require-dev": {
"symfony/event-dispatcher": ">=2.1,<3.0"
},
"time": "2013-04-13 14:06:01",
"time": "2013-05-16 07:54:39",
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "2.3-dev"
"dev-master": "2.4-dev"
}
},
"installation-source": "source",
"autoload": {
"psr-0": {
"Symfony\\Component\\Console\\": ""
"Symfony\\Component\\Yaml\\": ""
}
},
"notification-url": "https://packagist.org/downloads/",
@ -92,7 +100,7 @@
"homepage": "http://symfony.com/contributors"
}
],
"description": "Symfony Console Component",
"description": "Symfony Yaml Component",
"homepage": "http://symfony.com"
}
]

@ -11,6 +11,8 @@
namespace Symfony\Component\Console;
use Symfony\Component\Console\Descriptor\TextDescriptor;
use Symfony\Component\Console\Descriptor\XmlDescriptor;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\ArgvInput;
use Symfony\Component\Console\Input\ArrayInput;
@ -29,9 +31,9 @@ use Symfony\Component\Console\Helper\DialogHelper;
use Symfony\Component\Console\Helper\ProgressHelper;
use Symfony\Component\Console\Helper\TableHelper;
use Symfony\Component\Console\Event\ConsoleCommandEvent;
use Symfony\Component\Console\Event\ConsoleForExceptionEvent;
use Symfony\Component\Console\Event\ConsoleExceptionEvent;
use Symfony\Component\Console\Event\ConsoleTerminateEvent;
use Symfony\Component\EventDispatcher\EventDispatcher;
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
/**
* An Application is the container for a collection of commands.
@ -86,7 +88,7 @@ class Application
}
}
public function setDispatcher(EventDispatcher $dispatcher)
public function setDispatcher(EventDispatcherInterface $dispatcher)
{
$this->dispatcher = $dispatcher;
}
@ -113,6 +115,8 @@ class Application
$output = new ConsoleOutput();
}
$this->configureIO($input, $output);
try {
$exitCode = $this->doRun($input, $output);
} catch (\Exception $e) {
@ -125,9 +129,16 @@ class Application
} else {
$this->renderException($e, $output);
}
$exitCode = $e->getCode();
$exitCode = is_numeric($exitCode) && $exitCode ? $exitCode : 1;
$exitCode = $e->getCode();
if (is_numeric($exitCode)) {
$exitCode = (int) $exitCode;
if (0 === $exitCode) {
$exitCode = 1;
}
} else {
$exitCode = 1;
}
}
if ($this->autoExit) {
@ -152,14 +163,13 @@ class Application
*/
public function doRun(InputInterface $input, OutputInterface $output)
{
$name = $this->getCommandName($input);
if (true === $input->hasParameterOption(array('--version', '-V'))) {
$output->writeln($this->getLongVersion());
if (true === $input->hasParameterOption(array('--ansi'))) {
$output->setDecorated(true);
} elseif (true === $input->hasParameterOption(array('--no-ansi'))) {
$output->setDecorated(false);
return 0;
}
$name = $this->getCommandName($input);
if (true === $input->hasParameterOption(array('--help', '-h'))) {
if (!$name) {
$name = 'help';
@ -169,29 +179,6 @@ class Application
}
}
if (true === $input->hasParameterOption(array('--no-interaction', '-n'))) {
$input->setInteractive(false);
}
if (function_exists('posix_isatty') && $this->getHelperSet()->has('dialog')) {
$inputStream = $this->getHelperSet()->get('dialog')->getInputStream();
if (!posix_isatty($inputStream)) {
$input->setInteractive(false);
}
}
if (true === $input->hasParameterOption(array('--quiet', '-q'))) {
$output->setVerbosity(OutputInterface::VERBOSITY_QUIET);
} elseif (true === $input->hasParameterOption(array('--verbose', '-v'))) {
$output->setVerbosity(OutputInterface::VERBOSITY_VERBOSE);
}
if (true === $input->hasParameterOption(array('--version', '-V'))) {
$output->writeln($this->getLongVersion());
return 0;
}
if (!$name) {
$name = 'list';
$input = new ArrayInput(array('command' => 'list'));
@ -204,7 +191,7 @@ class Application
$exitCode = $this->doRunCommand($command, $input, $output);
$this->runningCommand = null;
return is_numeric($exitCode) ? $exitCode : 0;
return $exitCode;
}
/**
@ -591,6 +578,10 @@ class Application
return $this->get($abbrevs[$searchName][0]);
}
if (isset($abbrevs[$searchName]) && in_array($searchName, $abbrevs[$searchName])) {
return $this->get($searchName);
}
if (isset($abbrevs[$searchName]) && count($abbrevs[$searchName]) > 1) {
$suggestions = $this->getAbbreviationSuggestions($abbrevs[$searchName]);
@ -687,47 +678,14 @@ class Application
* @param boolean $raw Whether to return raw command list
*
* @return string A string representing the Application
*
* @deprecated Deprecated since version 2.3, to be removed in 3.0.
*/
public function asText($namespace = null, $raw = false)
{
$commands = $namespace ? $this->all($this->findNamespace($namespace)) : $this->commands;
$descriptor = new TextDescriptor();
$width = 0;
foreach ($commands as $command) {
$width = strlen($command->getName()) > $width ? strlen($command->getName()) : $width;
}
$width += 2;
if ($raw) {
$messages = array();
foreach ($this->sortCommands($commands) as $space => $commands) {
foreach ($commands as $name => $command) {
$messages[] = sprintf("%-${width}s %s", $name, $command->getDescription());
}
}
return implode(PHP_EOL, $messages);
}
$messages = array($this->getHelp(), '');
if ($namespace) {
$messages[] = sprintf("<comment>Available commands for the \"%s\" namespace:</comment>", $namespace);
} else {
$messages[] = '<comment>Available commands:</comment>';
}
// add commands by namespace
foreach ($this->sortCommands($commands) as $space => $commands) {
if (!$namespace && '_global' !== $space) {
$messages[] = '<comment>'.$space.'</comment>';
}
foreach ($commands as $name => $command) {
$messages[] = sprintf(" <info>%-${width}s</info> %s", $name, $command->getDescription());
}
}
return implode(PHP_EOL, $messages);
return $descriptor->describe($this, array('namespace' => $namespace, 'raw_text' => $raw));
}
/**
@ -736,52 +694,15 @@ class Application
* @param string $namespace An optional namespace name
* @param Boolean $asDom Whether to return a DOM or an XML string
*
* @return string|DOMDocument An XML string representing the Application
* @return string|\DOMDocument An XML string representing the Application
*
* @deprecated Deprecated since version 2.3, to be removed in 3.0.
*/
public function asXml($namespace = null, $asDom = false)
{
$commands = $namespace ? $this->all($this->findNamespace($namespace)) : $this->commands;
$descriptor = new XmlDescriptor();
$dom = new \DOMDocument('1.0', 'UTF-8');
$dom->formatOutput = true;
$dom->appendChild($xml = $dom->createElement('symfony'));
$xml->appendChild($commandsXML = $dom->createElement('commands'));
if ($namespace) {
$commandsXML->setAttribute('namespace', $namespace);
} else {
$namespacesXML = $dom->createElement('namespaces');
$xml->appendChild($namespacesXML);
}
// add commands by namespace
foreach ($this->sortCommands($commands) as $space => $commands) {
if (!$namespace) {
$namespaceArrayXML = $dom->createElement('namespace');
$namespacesXML->appendChild($namespaceArrayXML);
$namespaceArrayXML->setAttribute('id', $space);
}
foreach ($commands as $name => $command) {
if ($name !== $command->getName()) {
continue;
}
if (!$namespace) {
$commandXML = $dom->createElement('command');
$namespaceArrayXML->appendChild($commandXML);
$commandXML->appendChild($dom->createTextNode($name));
}
$node = $command->asXml(true)->getElementsByTagName('command')->item(0);
$node = $dom->importNode($node, true);
$commandsXML->appendChild($node);
}
}
return $asDom ? $dom : $dom->saveXml();
return $descriptor->describe($this, array('namespace' => $namespace, 'as_dom' => $asDom));
}
/**
@ -832,7 +753,7 @@ class Application
$output->writeln("");
$output->writeln("");
if (OutputInterface::VERBOSITY_VERBOSE === $output->getVerbosity()) {
if (OutputInterface::VERBOSITY_VERBOSE <= $output->getVerbosity()) {
$output->writeln('<comment>Exception trace:</comment>');
// exception related properties
@ -922,6 +843,44 @@ class Application
return array(null, null);
}
/**
* Configures the input and output instances based on the user arguments and options.
*
* @param InputInterface $input An InputInterface instance
* @param OutputInterface $output An OutputInterface instance
*/
protected function configureIO(InputInterface $input, OutputInterface $output)
{
if (true === $input->hasParameterOption(array('--ansi'))) {
$output->setDecorated(true);
} elseif (true === $input->hasParameterOption(array('--no-ansi'))) {
$output->setDecorated(false);
}
if (true === $input->hasParameterOption(array('--no-interaction', '-n'))) {
$input->setInteractive(false);
}
if (function_exists('posix_isatty') && $this->getHelperSet()->has('dialog')) {
$inputStream = $this->getHelperSet()->get('dialog')->getInputStream();
if (!posix_isatty($inputStream)) {
$input->setInteractive(false);
}
}
if (true === $input->hasParameterOption(array('--quiet', '-q'))) {
$output->setVerbosity(OutputInterface::VERBOSITY_QUIET);
} else {
if ($input->hasParameterOption('-vvv') || $input->hasParameterOption('--verbose=3') || $input->getParameterOption('--verbose') === 3) {
$output->setVerbosity(OutputInterface::VERBOSITY_DEBUG);
} elseif ($input->hasParameterOption('-vv') || $input->hasParameterOption('--verbose=2') || $input->getParameterOption('--verbose') === 2) {
$output->setVerbosity(OutputInterface::VERBOSITY_VERY_VERBOSE);
} elseif ($input->hasParameterOption('-v') || $input->hasParameterOption('--verbose=1') || $input->hasParameterOption('--verbose') || $input->getParameterOption('--verbose')) {
$output->setVerbosity(OutputInterface::VERBOSITY_VERBOSE);
}
}
}
/**
* Runs the current command.
*
@ -949,7 +908,7 @@ class Application
$event = new ConsoleTerminateEvent($command, $input, $output, $e->getCode());
$this->dispatcher->dispatch(ConsoleEvents::TERMINATE, $event);
$event = new ConsoleForExceptionEvent($command, $input, $output, $e, $event->getExitCode());
$event = new ConsoleExceptionEvent($command, $input, $output, $e, $event->getExitCode());
$this->dispatcher->dispatch(ConsoleEvents::EXCEPTION, $event);
throw $event->getException();
@ -985,7 +944,7 @@ class Application
new InputOption('--help', '-h', InputOption::VALUE_NONE, 'Display this help message.'),
new InputOption('--quiet', '-q', InputOption::VALUE_NONE, 'Do not output any message.'),
new InputOption('--verbose', '-v', InputOption::VALUE_NONE, 'Increase verbosity of messages.'),
new InputOption('--verbose', '-v|vv|vvv', InputOption::VALUE_NONE, 'Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug'),
new InputOption('--version', '-V', InputOption::VALUE_NONE, 'Display this application version.'),
new InputOption('--ansi', '', InputOption::VALUE_NONE, 'Force ANSI output.'),
new InputOption('--no-ansi', '', InputOption::VALUE_NONE, 'Disable ANSI output.'),
@ -1066,33 +1025,6 @@ class Application
}
}
/**
* Sorts commands in alphabetical order.
*
* @param array $commands An associative array of commands to sort
*
* @return array A sorted array of commands
*/
private function sortCommands($commands)
{
$namespacedCommands = array();
foreach ($commands as $name => $command) {
$key = $this->extractNamespace($name, 1);
if (!$key) {
$key = '_global';
}
$namespacedCommands[$key][$name] = $command;
}
ksort($namespacedCommands);
foreach ($namespacedCommands as &$commands) {
ksort($commands);
}
return $namespacedCommands;
}
/**
* Returns abbreviated suggestions in string format.
*
@ -1108,12 +1040,14 @@ class Application
/**
* Returns the namespace part of the command name.
*
* This method is not part of public API and should not be used directly.
*
* @param string $name The full name of the command
* @param string $limit The maximum number of parts of the namespace
*
* @return string The namespace of the command
*/
private function extractNamespace($name, $limit = null)
public function extractNamespace($name, $limit = null)
{
$parts = explode(':', $name);
array_pop($parts);

@ -4,10 +4,13 @@ CHANGELOG
2.3.0
-----
* added multiselect support to the select dialog helper
* added Table Helper for tabular data rendering
* added support for events in `Application`
* added a way to normalize EOLs in `ApplicationTester::getDisplay()` and `CommandTester::getDisplay()`
* added a way to set the progress bar progress via the `setCurrent` method
* added support for multiple InputOption shortcuts, written as `'-a|-b|-c'`
* added two additional verbosity levels, VERBOSITY_VERY_VERBOSE and VERBOSITY_DEBUG
2.2.0
-----

@ -11,6 +11,8 @@
namespace Symfony\Component\Console\Command;
use Symfony\Component\Console\Descriptor\TextDescriptor;
use Symfony\Component\Console\Descriptor\XmlDescriptor;
use Symfony\Component\Console\Input\InputDefinition;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Input\InputArgument;
@ -36,6 +38,7 @@ class Command
private $description;
private $ignoreValidationErrors;
private $applicationDefinitionMerged;
private $applicationDefinitionMergedWithArgs;
private $code;
private $synopsis;
private $helperSet;
@ -54,6 +57,7 @@ class Command
$this->definition = new InputDefinition();
$this->ignoreValidationErrors = false;
$this->applicationDefinitionMerged = false;
$this->applicationDefinitionMergedWithArgs = false;
$this->aliases = array();
if (null !== $name) {
@ -240,7 +244,7 @@ class Command
$statusCode = $this->execute($input, $output);
}
return is_numeric($statusCode) ? $statusCode : 0;
return is_numeric($statusCode) ? (int) $statusCode : 0;
}
/**
@ -273,11 +277,13 @@ class Command
/**
* Merges the application definition with the command definition.
*
* This method is not part of public API and should not be used directly.
*
* @param Boolean $mergeArgs Whether to merge or not the Application definition arguments to Command definition arguments
*/
private function mergeApplicationDefinition($mergeArgs = true)
public function mergeApplicationDefinition($mergeArgs = true)
{
if (null === $this->application || true === $this->applicationDefinitionMerged) {
if (null === $this->application || (true === $this->applicationDefinitionMerged && ($this->applicationDefinitionMergedWithArgs || !$mergeArgs))) {
return;
}
@ -290,6 +296,9 @@ class Command
$this->definition->addOptions($this->application->getDefinition()->getOptions());
$this->applicationDefinitionMerged = true;
if ($mergeArgs) {
$this->applicationDefinitionMergedWithArgs = true;
}
}
/**
@ -332,9 +341,11 @@ class Command
* Can be overridden to provide the original command representation when it would otherwise
* be changed by merging with the application InputDefinition.
*
* This method is not part of public API and should not be used directly.
*
* @return InputDefinition An InputDefinition instance
*/
protected function getNativeDefinition()
public function getNativeDefinition()
{
return $this->getDefinition();
}
@ -559,32 +570,14 @@ class Command
* Returns a text representation of the command.
*
* @return string A string representing the command
*
* @deprecated Deprecated since version 2.3, to be removed in 3.0.
*/
public function asText()
{
if ($this->application && !$this->applicationDefinitionMerged) {
$this->getSynopsis();
$this->mergeApplicationDefinition(false);
}
$messages = array(
'<comment>Usage:</comment>',
' '.$this->getSynopsis(),
'',
);
if ($this->getAliases()) {
$messages[] = '<comment>Aliases:</comment> <info>'.implode(', ', $this->getAliases()).'</info>';
}
$messages[] = $this->getNativeDefinition()->asText();
$descriptor = new TextDescriptor();
if ($help = $this->getProcessedHelp()) {
$messages[] = '<comment>Help:</comment>';
$messages[] = ' '.str_replace("\n", "\n ", $help)."\n";
}
return implode("\n", $messages);
return $descriptor->describe($this);
}
/**
@ -592,41 +585,15 @@ class Command
*
* @param Boolean $asDom Whether to return a DOM or an XML string
*
* @return string|DOMDocument An XML string representing the command
* @return string|\DOMDocument An XML string representing the command
*
* @deprecated Deprecated since version 2.3, to be removed in 3.0.
*/
public function asXml($asDom = false)
{
if ($this->application && !$this->applicationDefinitionMerged) {
$this->getSynopsis();
$this->mergeApplicationDefinition(false);
}
$dom = new \DOMDocument('1.0', 'UTF-8');
$dom->formatOutput = true;
$dom->appendChild($commandXML = $dom->createElement('command'));
$commandXML->setAttribute('id', $this->name);
$commandXML->setAttribute('name', $this->name);
$commandXML->appendChild($usageXML = $dom->createElement('usage'));
$usageXML->appendChild($dom->createTextNode(sprintf($this->getSynopsis(), '')));
$commandXML->appendChild($descriptionXML = $dom->createElement('description'));
$descriptionXML->appendChild($dom->createTextNode(str_replace("\n", "\n ", $this->getDescription())));
$commandXML->appendChild($helpXML = $dom->createElement('help'));
$helpXML->appendChild($dom->createTextNode(str_replace("\n", "\n ", $this->getProcessedHelp())));
$commandXML->appendChild($aliasesXML = $dom->createElement('aliases'));
foreach ($this->getAliases() as $alias) {
$aliasesXML->appendChild($aliasXML = $dom->createElement('alias'));
$aliasXML->appendChild($dom->createTextNode($alias));
}
$definition = $this->getNativeDefinition()->asXml(true);
$commandXML->appendChild($dom->importNode($definition->getElementsByTagName('arguments')->item(0), true));
$commandXML->appendChild($dom->importNode($definition->getElementsByTagName('options')->item(0), true));
$descriptor = new XmlDescriptor();
return $asDom ? $dom : $dom->saveXml();
return $descriptor->describe($this, array('as_dom' => $asDom));
}
private function validateName($name)

@ -11,11 +11,11 @@
namespace Symfony\Component\Console\Command;
use Symfony\Component\Console\Helper\DescriptorHelper;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Command\Command;
/**
* HelpCommand displays the help for a given command.
@ -38,6 +38,8 @@ class HelpCommand extends Command
->setDefinition(array(
new InputArgument('command_name', InputArgument::OPTIONAL, 'The command name', 'help'),
new InputOption('xml', null, InputOption::VALUE_NONE, 'To output help as XML'),
new InputOption('format', null, InputOption::VALUE_REQUIRED, 'To output help in other formats'),
new InputOption('raw', null, InputOption::VALUE_NONE, 'To output raw command help'),
))
->setDescription('Displays help for a command')
->setHelp(<<<EOF
@ -45,9 +47,9 @@ The <info>%command.name%</info> command displays help for a given command:
<info>php %command.full_name% list</info>
You can also output the help as XML by using the <comment>--xml</comment> option:
You can also output the help in other formats by using the <comment>--format</comment> option:
<info>php %command.full_name% --xml list</info>
<info>php %command.full_name% --format=xml list</info>
To display the list of available commands, please use the <info>list</info> command.
EOF
@ -75,11 +77,11 @@ EOF
}
if ($input->getOption('xml')) {
$output->writeln($this->command->asXml(), OutputInterface::OUTPUT_RAW);
} else {
$output->writeln($this->command->asText());
$input->setOption('format', 'xml');
}
$helper = new DescriptorHelper();
$helper->describe($output, $this->command, $input->getOption('format'), $input->getOption('raw'));
$this->command = null;
}
}

@ -11,11 +11,11 @@
namespace Symfony\Component\Console\Command;
use Symfony\Component\Console\Helper\DescriptorHelper;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputDefinition;
/**
@ -43,9 +43,9 @@ You can also display the commands for a specific namespace:
<info>php %command.full_name% test</info>
You can also output the information as XML by using the <comment>--xml</comment> option:
You can also output the information in other formats by using the <comment>--format</comment> option:
<info>php %command.full_name% --xml</info>
<info>php %command.full_name% --format=xml</info>
It's also possible to get raw list of commands (useful for embedding command runner):
@ -58,7 +58,7 @@ EOF
/**
* {@inheritdoc}
*/
protected function getNativeDefinition()
public function getNativeDefinition()
{
return $this->createDefinition();
}
@ -69,18 +69,23 @@ EOF
protected function execute(InputInterface $input, OutputInterface $output)
{
if ($input->getOption('xml')) {
$output->writeln($this->getApplication()->asXml($input->getArgument('namespace')), OutputInterface::OUTPUT_RAW);
} else {
$output->writeln($this->getApplication()->asText($input->getArgument('namespace'), $input->getOption('raw')));
$input->setOption('format', 'xml');
}
$helper = new DescriptorHelper();
$helper->describe($output, $this->getApplication(), $input->getOption('format'), $input->getOption('raw'), $input->getArgument('namespace'));
}
/**
* {@inheritdoc}
*/
private function createDefinition()
{
return new InputDefinition(array(
new InputArgument('namespace', InputArgument::OPTIONAL, 'The namespace name'),
new InputOption('xml', null, InputOption::VALUE_NONE, 'To output help as XML'),
new InputOption('xml', null, InputOption::VALUE_NONE, 'To output list as XML'),
new InputOption('raw', null, InputOption::VALUE_NONE, 'To output raw command list'),
new InputOption('format', null, InputOption::VALUE_REQUIRED, 'To output list in other formats'),
));
}
}

@ -46,7 +46,7 @@ final class ConsoleEvents
*
* This event allows you to deal with the exception or
* to modify the thrown exception. The event listener method receives
* a Symfony\Component\Console\Event\ConsoleForExceptionEvent
* a Symfony\Component\Console\Event\ConsoleExceptionEvent
* instance.
*
* @var string

@ -0,0 +1,153 @@
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Console\Descriptor;
use Symfony\Component\Console\Application;
use Symfony\Component\Console\Command\Command;
/**
* @author Jean-François Simon <jeanfrancois.simon@sensiolabs.com>
*/
class ApplicationDescription
{
const GLOBAL_NAMESPACE = '_global';
/**
* @var Application
*/
private $application;
/**
* @var null|string
*/
private $namespace;
/**
* @var array
*/
private $namespaces;
/**
* @var Command[]
*/
private $commands;
/**
* @var Command[]
*/
private $aliases;
/**
* Constructor.
*
* @param Application $application
* @param string|null $namespace
*/
public function __construct(Application $application, $namespace = null)
{
$this->application = $application;
$this->namespace = $namespace;
}
/**
* @return array
*/
public function getNamespaces()
{
if (null === $this->namespaces) {
$this->inspectApplication();
}
return $this->namespaces;
}
/**
* @return Command[]
*/
public function getCommands()
{
if (null === $this->commands) {
$this->inspectApplication();
}
return $this->commands;
}
/**
* @param string $name
*
* @return Command
*
* @throws \InvalidArgumentException
*/
public function getCommand($name)
{
if (!isset($this->commands[$name]) && !isset($this->aliases[$name])) {
throw new \InvalidArgumentException(sprintf('Command %s does not exist.', $name));
}
return isset($this->commands[$name]) ? $this->commands[$name] : $this->aliases[$name];
}
private function inspectApplication()
{
$this->commands = array();
$this->namespaces = array();
$all = $this->application->all($this->namespace ? $this->application->findNamespace($this->namespace) : null);
foreach ($this->sortCommands($all) as $namespace => $commands) {
$names = array();
/** @var Command $command */
foreach ($commands as $name => $command) {
if (!$command->getName()) {
continue;
}
if ($command->getName() === $name) {
$this->commands[$name] = $command;
} else {
$this->aliases[$name] = $command;
}
$names[] = $name;
}
$this->namespaces[$namespace] = array('id' => $namespace, 'commands' => $names);
}
}
/**
* @param array $commands
*
* @return array
*/
private function sortCommands(array $commands)
{
$namespacedCommands = array();
foreach ($commands as $name => $command) {
$key = $this->application->extractNamespace($name, 1);
if (!$key) {
$key = '_global';
}
$namespacedCommands[$key][$name] = $command;
}
ksort($namespacedCommands);
foreach ($namespacedCommands as &$commands) {
ksort($commands);
}
return $namespacedCommands;
}
}

@ -0,0 +1,92 @@
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Console\Descriptor;
use Symfony\Component\Console\Application;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputDefinition;
use Symfony\Component\Console\Input\InputOption;
/**
* @author Jean-François Simon <jeanfrancois.simon@sensiolabs.com>
*/
abstract class Descriptor implements DescriptorInterface
{
public function describe($object, array $options = array())
{
switch (true) {
case $object instanceof InputArgument:
return $this->describeInputArgument($object, $options);
case $object instanceof InputOption:
return $this->describeInputOption($object, $options);
case $object instanceof InputDefinition:
return $this->describeInputDefinition($object, $options);
case $object instanceof Command:
return $this->describeCommand($object, $options);
case $object instanceof Application:
return $this->describeApplication($object, $options);
}
throw new \InvalidArgumentException(sprintf('Object of type "%s" is not describable.', get_class($object)));
}
/**
* Describes an InputArgument instance.
*
* @param InputArgument $argument
* @param array $options
*
* @return string|mixed
*/
abstract protected function describeInputArgument(InputArgument $argument, array $options = array());
/**
* Describes an InputOption instance.
*
* @param InputOption $option
* @param array $options
*
* @return string|mixed
*/
abstract protected function describeInputOption(InputOption $option, array $options = array());
/**
* Describes an InputDefinition instance.
*
* @param InputDefinition $definition
* @param array $options
*
* @return string|mixed
*/
abstract protected function describeInputDefinition(InputDefinition $definition, array $options = array());
/**
* Describes a Command instance.
*
* @param Command $command
* @param array $options
*
* @return string|mixed
*/
abstract protected function describeCommand(Command $command, array $options = array());
/**
* Describes an Application instance.
*
* @param Application $application
* @param array $options
*
* @return string|mixed
*/
abstract protected function describeApplication(Application $application, array $options = array());
}

@ -0,0 +1,30 @@
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Console\Descriptor;
/**
* Descriptor interface.
*
* @author Jean-François Simon <contact@jfsimon.fr>
*/
interface DescriptorInterface
{
/**
* Describes an InputArgument instance.
*
* @param object $object
* @param array $options
*
* @return string|mixed
*/
public function describe($object, array $options = array());
}

@ -0,0 +1,129 @@
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Console\Descriptor;
use Symfony\Component\Console\Application;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputDefinition;
use Symfony\Component\Console\Input\InputOption;
/**
* JSON descriptor.
*
* @author Jean-François Simon <contact@jfsimon.fr>
*/
class JsonDescriptor extends Descriptor
{
/**
* {@inheritdoc}
*/
protected function describeInputArgument(InputArgument $argument, array $options = array())
{
return $this->output(array(
'name' => $argument->getName(),
'is_required' => $argument->isRequired(),
'is_array' => $argument->isArray(),
'description' => $argument->getDescription(),
'default' => $argument->getDefault(),
), $options);
}
/**
* {@inheritdoc}
*/
protected function describeInputOption(InputOption $option, array $options = array())
{
return $this->output(array(
'name' => '--'.$option->getName(),
'shortcut' => $option->getShortcut() ? '-'.implode('|-', explode('|', $option->getShortcut())) : '',
'accept_value' => $option->acceptValue(),
'is_value_required' => $option->isValueRequired(),
'is_multiple' => $option->isArray(),
'description' => $option->getDescription(),
'default' => $option->getDefault(),
), $options);
}
/**
* {@inheritdoc}
*/
protected function describeInputDefinition(InputDefinition $definition, array $options = array())
{
$inputArguments = array();
foreach ($definition->getArguments() as $name => $argument) {
$inputArguments[$name] = $this->describeInputArgument($argument, array('as_array' => true));
}
$inputOptions = array();
foreach ($definition->getOptions() as $name => $option) {
$inputOptions[$name] = $this->describeInputOption($option, array('as_array' => true));
}
return $this->output(array('arguments' => $inputArguments, 'options' => $inputOptions), $options);
}
/**
* {@inheritdoc}
*/
protected function describeCommand(Command $command, array $options = array())
{
$command->getSynopsis();
$command->mergeApplicationDefinition(false);
return $this->output(array(
'name' => $command->getName(),
'usage' => $command->getSynopsis(),
'description' => $command->getDescription(),
'help' => $command->getProcessedHelp(),
'aliases' => $command->getAliases(),
'definition' => $this->describeInputDefinition($command->getNativeDefinition(), array('as_array' => true)),
), $options);
}
/**
* {@inheritdoc}
*/
protected function describeApplication(Application $application, array $options = array())
{
$describedNamespace = isset($options['namespace']) ? $options['namespace'] : null;
$description = new ApplicationDescription($application, $describedNamespace);
$commands = array();
foreach ($description->getCommands() as $command) {
$commands[] = $this->describeCommand($command, array('as_array' => true));
}
$data = $describedNamespace
? array('commands' => $commands, 'namespace' => $describedNamespace)
: array('commands' => $commands, 'namespaces' => array_values($description->getNamespaces()));
return $this->output($data, $options);
}
/**
* Outputs data as array or string according to options.
*
* @param array $data
* @param array $options
*
* @return array|string
*/
private function output(array $data, array $options)
{
if (isset($options['as_array']) && $options['as_array']) {
return $data;
}
return json_encode($data, isset($options['json_encoding']) ? $options['json_encoding'] : 0);
}
}

@ -0,0 +1,129 @@
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Console\Descriptor;
use Symfony\Component\Console\Application;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputDefinition;
use Symfony\Component\Console\Input\InputOption;
/**
* Markdown descriptor.
*
* @author Jean-François Simon <contact@jfsimon.fr>
*/
class MarkdownDescriptor extends Descriptor
{
/**
* {@inheritdoc}
*/
protected function describeInputArgument(InputArgument $argument, array $options = array())
{
return '**'.$argument->getName().':**'."\n\n"
.'* Name: '.($argument->getName() ?: '<none>')."\n"
.'* Is required: '.($argument->isRequired() ? 'yes' : 'no')."\n"
.'* Is array: '.($argument->isArray() ? 'yes' : 'no')."\n"
.'* Description: '.($argument->getDescription() ?: '<none>')."\n"
.'* Default: `'.str_replace("\n", '', var_export($argument->getDefault(), true)).'`';
}
/**
* {@inheritdoc}
*/
protected function describeInputOption(InputOption $option, array $options = array())
{
return '**'.$option->getName().':**'."\n\n"
.'* Name: `--'.$option->getName().'`'."\n"
.'* Shortcut: '.($option->getShortcut() ? '`-'.implode('|-', explode('|', $option->getShortcut())).'`' : '<none>')."\n"
.'* Accept value: '.($option->acceptValue() ? 'yes' : 'no')."\n"
.'* Is value required: '.($option->isValueRequired() ? 'yes' : 'no')."\n"
.'* Is multiple: '.($option->isArray() ? 'yes' : 'no')."\n"
.'* Description: '.($option->getDescription() ?: '<none>')."\n"
.'* Default: `'.str_replace("\n", '', var_export($option->getDefault(), true)).'`';
}
/**
* {@inheritdoc}
*/
protected function describeInputDefinition(InputDefinition $definition, array $options = array())
{
$blocks = array();
if (count($definition->getArguments()) > 0) {
$blocks[] = '### Arguments:';
foreach ($definition->getArguments() as $argument) {
$blocks[] = $this->describeInputArgument($argument);
}
}
if (count($definition->getOptions()) > 0) {
$blocks[] = '### Options:';
foreach ($definition->getOptions() as $option) {
$blocks[] = $this->describeInputOption($option);
}
}
return implode("\n\n", $blocks);
}
/**
* {@inheritdoc}
*/
protected function describeCommand(Command $command, array $options = array())
{
$command->getSynopsis();
$command->mergeApplicationDefinition(false);
$markdown = $command->getName()."\n"
.str_repeat('-', strlen($command->getName()))."\n\n"
.'* Description: '.($command->getDescription() ?: '<none>')."\n"
.'* Usage: `'.$command->getSynopsis().'`'."\n"
.'* Aliases: '.(count($command->getAliases()) ? '`'.implode('`, `', $command->getAliases()).'`' : '<none>');
if ($help = $command->getProcessedHelp()) {
$markdown .= "\n\n".$help;
}
if ($definitionMarkdown = $this->describeInputDefinition($command->getNativeDefinition())) {
$markdown .= "\n\n".$definitionMarkdown;
}
return $markdown;
}
/**
* {@inheritdoc}
*/
protected function describeApplication(Application $application, array $options = array())
{
$describedNamespace = isset($options['namespace']) ? $options['namespace'] : null;
$description = new ApplicationDescription($application, $describedNamespace);
$blocks = array($application->getName()."\n".str_repeat('=', strlen($application->getName())));
foreach ($description->getNamespaces() as $namespace) {
if (ApplicationDescription::GLOBAL_NAMESPACE !== $namespace['id']) {
$blocks[] = '**'.$namespace['id'].':**';
}
$blocks[] = implode("\n", array_map(function ($commandName) {
return '* '.$commandName;
} , $namespace['commands']));
}
foreach ($description->getCommands() as $command) {
$blocks[] = $this->describeCommand($command);
}
return implode("\n\n", $blocks);
}
}

@ -0,0 +1,210 @@
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Console\Descriptor;
use Symfony\Component\Console\Application;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputDefinition;
use Symfony\Component\Console\Input\InputOption;
/**
* Text descriptor.
*
* @author Jean-François Simon <contact@jfsimon.fr>
*/
class TextDescriptor extends Descriptor
{
/**
* {@inheritdoc}
*/
protected function describeInputArgument(InputArgument $argument, array $options = array())
{
if (null !== $argument->getDefault() && (!is_array($argument->getDefault()) || count($argument->getDefault()))) {
$default = sprintf('<comment> (default: %s)</comment>', $this->formatDefaultValue($argument->getDefault()));
} else {
$default = '';
}
$nameWidth = isset($options['name_width']) ? $options['name_width'] : strlen($argument->getName());
$output = str_replace("\n", "\n".str_repeat(' ', $nameWidth + 2), $argument->getDescription());
$output = sprintf(" <info>%-${nameWidth}s</info> %s%s", $argument->getName(), $output, $default);
return isset($options['raw_text']) && $options['raw_text'] ? strip_tags($output) : $output;
}
/**
* {@inheritdoc}
*/
protected function describeInputOption(InputOption $option, array $options = array())
{
if ($option->acceptValue() && null !== $option->getDefault() && (!is_array($option->getDefault()) || count($option->getDefault()))) {
$default = sprintf('<comment> (default: %s)</comment>', $this->formatDefaultValue($option->getDefault()));
} else {
$default = '';
}
$nameWidth = isset($options['name_width']) ? $options['name_width'] : strlen($option->getName());
$nameWithShortcutWidth = $nameWidth - strlen($option->getName()) - 2;
$output = sprintf(" <info>%s</info> %-${nameWithShortcutWidth}s%s%s%s",
'--'.$option->getName(),
$option->getShortcut() ? sprintf('(-%s) ', $option->getShortcut()) : '',
str_replace("\n", "\n".str_repeat(' ', $nameWidth + 2), $option->getDescription()),
$default,
$option->isArray() ? '<comment> (multiple values allowed)</comment>' : ''
);
return isset($options['raw_text']) && $options['raw_text'] ? strip_tags($output) : $output;
}
/**
* {@inheritdoc}
*/
protected function describeInputDefinition(InputDefinition $definition, array $options = array())
{
$nameWidth = 0;
foreach ($definition->getOptions() as $option) {
$nameLength = strlen($option->getName()) + 2;
if ($option->getShortcut()) {
$nameLength += strlen($option->getShortcut()) + 3;
}
$nameWidth = max($nameWidth, $nameLength);
}
foreach ($definition->getArguments() as $argument) {
$nameWidth = max($nameWidth, strlen($argument->getName()));
}
++$nameWidth;
$messages = array();
if ($definition->getArguments()) {
$messages[] = '<comment>Arguments:</comment>';
foreach ($definition->getArguments() as $argument) {
$messages[] = $this->describeInputArgument($argument, array('name_width' => $nameWidth));
}
$messages[] = '';
}
if ($definition->getOptions()) {
$messages[] = '<comment>Options:</comment>';
foreach ($definition->getOptions() as $option) {
$messages[] = $this->describeInputOption($option, array('name_width' => $nameWidth));
}
$messages[] = '';
}
$output = implode("\n", $messages);
return isset($options['raw_text']) && $options['raw_text'] ? strip_tags($output) : $output;
}
/**
* {@inheritdoc}
*/
protected function describeCommand(Command $command, array $options = array())
{
$command->getSynopsis();
$command->mergeApplicationDefinition(false);
$messages = array('<comment>Usage:</comment>', ' '.$command->getSynopsis(), '');
if ($command->getAliases()) {
$messages[] = '<comment>Aliases:</comment> <info>'.implode(', ', $command->getAliases()).'</info>';
}
$messages[] = $this->describeInputDefinition($command->getNativeDefinition());
if ($help = $command->getProcessedHelp()) {
$messages[] = '<comment>Help:</comment>';
$messages[] = ' '.str_replace("\n", "\n ", $help)."\n";
}
$output = implode("\n", $messages);
return isset($options['raw_text']) && $options['raw_text'] ? strip_tags($output) : $output;
}
/**
* {@inheritdoc}
*/
protected function describeApplication(Application $application, array $options = array())
{
$describedNamespace = isset($options['namespace']) ? $options['namespace'] : null;
$description = new ApplicationDescription($application, $describedNamespace);
$messages = array();
if (isset($options['raw_text']) && $options['raw_text']) {
$width = $this->getColumnWidth($description->getCommands());
foreach ($description->getCommands() as $command) {
$messages[] = sprintf("%-${width}s %s", $command->getName(), $command->getDescription());
}
} else {
$width = $this->getColumnWidth($description->getCommands());
$messages[] = $application->getHelp();
$messages[] = '';
if ($describedNamespace) {
$messages[] = sprintf("<comment>Available commands for the \"%s\" namespace:</comment>", $describedNamespace);
} else {
$messages[] = '<comment>Available commands:</comment>';
}
// add commands by namespace
foreach ($description->getNamespaces() as $namespace) {
if (!$describedNamespace && ApplicationDescription::GLOBAL_NAMESPACE !== $namespace['id']) {
$messages[] = '<comment>'.$namespace['id'].'</comment>';
}
foreach ($namespace['commands'] as $name) {
$messages[] = sprintf(" <info>%-${width}s</info> %s", $name, $description->getCommand($name)->getDescription());
}
}
}
$output = implode("\n", $messages);
return isset($options['raw_text']) && $options['raw_text'] ? strip_tags($output) : $output;
}
/**
* Formats input option/argument default value.
*
* @param mixed $default
*
* @return string
*/
private function formatDefaultValue($default)
{
if (version_compare(PHP_VERSION, '5.4', '<')) {
return str_replace('\/', '/', json_encode($default));
}
return json_encode($default, JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE);
}
/**
* @param Command[] $commands
*
* @return int
*/
private function getColumnWidth(array $commands)
{
$width = 0;
foreach ($commands as $command) {
$width = strlen($command->getName()) > $width ? strlen($command->getName()) : $width;
}
return $width + 2;
}
}

@ -0,0 +1,212 @@
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Console\Descriptor;
use Symfony\Component\Console\Application;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputDefinition;
use Symfony\Component\Console\Input\InputOption;
/**
* XML descriptor.
*
* @author Jean-François Simon <contact@jfsimon.fr>
*/
class XmlDescriptor extends Descriptor
{
/**
* {@inheritdoc}
*/
protected function describeInputArgument(InputArgument $argument, array $options = array())
{
$dom = new \DOMDocument('1.0', 'UTF-8');
$dom->appendChild($objectXML = $dom->createElement('argument'));
$objectXML->setAttribute('name', $argument->getName());
$objectXML->setAttribute('is_required', $argument->isRequired() ? 1 : 0);
$objectXML->setAttribute('is_array', $argument->isArray() ? 1 : 0);
$objectXML->appendChild($descriptionXML = $dom->createElement('description'));
$descriptionXML->appendChild($dom->createTextNode($argument->getDescription()));
$objectXML->appendChild($defaultsXML = $dom->createElement('defaults'));
$defaults = is_array($argument->getDefault()) ? $argument->getDefault() : (is_bool($argument->getDefault()) ? array(var_export($argument->getDefault(), true)) : ($argument->getDefault() ? array($argument->getDefault()) : array()));
foreach ($defaults as $default) {
$defaultsXML->appendChild($defaultXML = $dom->createElement('default'));
$defaultXML->appendChild($dom->createTextNode($default));
}
return $this->output($dom, $options);
}
/**
* {@inheritdoc}
*/
protected function describeInputOption(InputOption $option, array $options = array())
{
$dom = new \DOMDocument('1.0', 'UTF-8');
$dom->appendChild($objectXML = $dom->createElement('option'));
$objectXML->setAttribute('name', '--'.$option->getName());
$pos = strpos($option->getShortcut(), '|');
if (false !== $pos) {
$objectXML->setAttribute('shortcut', '-'.substr($option->getShortcut(), 0, $pos));
$objectXML->setAttribute('shortcuts', '-'.implode('|-', explode('|', $option->getShortcut())));
} else {
$objectXML->setAttribute('shortcut', $option->getShortcut() ? '-'.$option->getShortcut() : '');
}
$objectXML->setAttribute('accept_value', $option->acceptValue() ? 1 : 0);
$objectXML->setAttribute('is_value_required', $option->isValueRequired() ? 1 : 0);
$objectXML->setAttribute('is_multiple', $option->isArray() ? 1 : 0);
$objectXML->appendChild($descriptionXML = $dom->createElement('description'));
$descriptionXML->appendChild($dom->createTextNode($option->getDescription()));
if ($option->acceptValue()) {
$defaults = is_array($option->getDefault()) ? $option->getDefault() : (is_bool($option->getDefault()) ? array(var_export($option->getDefault(), true)) : ($option->getDefault() ? array($option->getDefault()) : array()));
$objectXML->appendChild($defaultsXML = $dom->createElement('defaults'));
if (!empty($defaults)) {
foreach ($defaults as $default) {
$defaultsXML->appendChild($defaultXML = $dom->createElement('default'));
$defaultXML->appendChild($dom->createTextNode($default));
}
}
}
return $this->output($dom, $options);
}
/**
* {@inheritdoc}
*/
protected function describeInputDefinition(InputDefinition $definition, array $options = array())
{
$dom = new \DOMDocument('1.0', 'UTF-8');
$dom->appendChild($definitionXML = $dom->createElement('definition'));
$definitionXML->appendChild($argumentsXML = $dom->createElement('arguments'));
foreach ($definition->getArguments() as $argument) {
$this->appendDocument($argumentsXML, $this->describeInputArgument($argument, array('as_dom' => true)));
}
$definitionXML->appendChild($optionsXML = $dom->createElement('options'));
foreach ($definition->getOptions() as $option) {
$this->appendDocument($optionsXML, $this->describeInputOption($option, array('as_dom' => true)));
}
return $this->output($dom, $options);
}
/**
* {@inheritdoc}
*/
protected function describeCommand(Command $command, array $options = array())
{
$dom = new \DOMDocument('1.0', 'UTF-8');
$dom->appendChild($commandXML = $dom->createElement('command'));
$command->getSynopsis();
$command->mergeApplicationDefinition(false);
$commandXML->setAttribute('id', $command->getName());
$commandXML->setAttribute('name', $command->getName());
$commandXML->appendChild($usageXML = $dom->createElement('usage'));
$usageXML->appendChild($dom->createTextNode(sprintf($command->getSynopsis(), '')));
$commandXML->appendChild($descriptionXML = $dom->createElement('description'));
$descriptionXML->appendChild($dom->createTextNode(str_replace("\n", "\n ", $command->getDescription())));
$commandXML->appendChild($helpXML = $dom->createElement('help'));
$helpXML->appendChild($dom->createTextNode(str_replace("\n", "\n ", $command->getProcessedHelp())));
$commandXML->appendChild($aliasesXML = $dom->createElement('aliases'));
foreach ($command->getAliases() as $alias) {
$aliasesXML->appendChild($aliasXML = $dom->createElement('alias'));
$aliasXML->appendChild($dom->createTextNode($alias));
}
$definitionXML = $this->describeInputDefinition($command->getNativeDefinition(), array('as_dom' => true));
$this->appendDocument($commandXML, $definitionXML->getElementsByTagName('definition')->item(0));
return $this->output($dom, $options);
}
/**
* {@inheritdoc}
*/
protected function describeApplication(Application $application, array $options = array())
{
$dom = new \DOMDocument('1.0', 'UTF-8');
$dom->appendChild($rootXml = $dom->createElement('symfony'));
$rootXml->appendChild($commandsXML = $dom->createElement('commands'));
$describedNamespace = isset($options['namespace']) ? $options['namespace'] : null;
$description = new ApplicationDescription($application, $describedNamespace);
if ($describedNamespace) {
$commandsXML->setAttribute('namespace', $describedNamespace);
}
foreach ($description->getCommands() as $command) {
$this->appendDocument($commandsXML, $this->describeCommand($command, array('as_dom' => true)));
}
if (!$describedNamespace) {
$rootXml->appendChild($namespacesXML = $dom->createElement('namespaces'));
foreach ($description->getNamespaces() as $namespace) {
$namespacesXML->appendChild($namespaceArrayXML = $dom->createElement('namespace'));
$namespaceArrayXML->setAttribute('id', $namespace['id']);
foreach ($namespace['commands'] as $name) {
$namespaceArrayXML->appendChild($commandXML = $dom->createElement('command'));
$commandXML->appendChild($dom->createTextNode($name));
}
}
}
return $this->output($dom, $options);
}
/**
* Appends document children to parent node.
*
* @param \DOMNode $parentNode
* @param \DOMNode $importedParent
*/
private function appendDocument(\DOMNode $parentNode, \DOMNode $importedParent)
{
foreach ($importedParent->childNodes as $childNode) {
$parentNode->appendChild($parentNode->ownerDocument->importNode($childNode, true));
}
}
/**
* Outputs document as DOMDocument or string according to options.
*
* @param \DOMDocument $dom
* @param array $options
*
* @return \DOMDocument|string
*/
private function output(\DOMDocument $dom, array $options)
{
if (isset($options['as_dom']) && $options['as_dom']) {
return $dom;
}
$dom->formatOutput = true;
return $dom->saveXML();
}
}

@ -11,10 +11,6 @@
namespace Symfony\Component\Console\Event;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
/**
* Allows to do things before the command is executed.
*

@ -0,0 +1,67 @@
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Console\Event;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
/**
* Allows to handle exception thrown in a command.
*
* @author Fabien Potencier <fabien@symfony.com>
*/
class ConsoleExceptionEvent extends ConsoleEvent
{
private $exception;
private $exitCode;
public function __construct(Command $command, InputInterface $input, OutputInterface $output, \Exception $exception, $exitCode)
{
parent::__construct($command, $input, $output);
$this->setException($exception);
$this->exitCode = (int) $exitCode;
}
/**
* Returns the thrown exception.
*
* @return \Exception The thrown exception
*/
public function getException()
{
return $this->exception;
}
/**
* Replaces the thrown exception.
*
* This exception will be thrown if no response is set in the event.
*
* @param \Exception $exception The thrown exception
*/
public function setException(\Exception $exception)
{
$this->exception = $exception;
}
/**
* Gets the exit code.
*
* @return integer The command exit code
*/
public function getExitCode()
{
return $this->exitCode;
}
}

@ -43,7 +43,7 @@ class ConsoleTerminateEvent extends ConsoleEvent
*/
public function setExitCode($exitCode)
{
$this->exitCode = $exitCode;
$this->exitCode = (int) $exitCode;
}
/**

@ -239,7 +239,7 @@ class OutputFormatter implements OutputFormatterInterface
*
* @param string $text Input text
*
* @return string string Styled text
* @return string Styled text
*/
private function applyCurrentStyle($text)
{

@ -0,0 +1,95 @@
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Console\Helper;
use Symfony\Component\Console\Application;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Descriptor\DescriptorInterface;
use Symfony\Component\Console\Descriptor\JsonDescriptor;
use Symfony\Component\Console\Descriptor\MarkdownDescriptor;
use Symfony\Component\Console\Descriptor\TextDescriptor;
use Symfony\Component\Console\Descriptor\XmlDescriptor;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputDefinition;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;
/**
* This class adds helper method to describe objects in various formats.
*
* @author Jean-François Simon <contact@jfsimon.fr>
*/
class DescriptorHelper extends Helper
{
/**
* @var DescriptorInterface[]
*/
private $descriptors = array();
/**
* Constructor.
*/
public function __construct()
{
$this
->register('txt', new TextDescriptor())
->register('xml', new XmlDescriptor())
->register('json', new JsonDescriptor())
->register('md', new MarkdownDescriptor())
;
}
/**
* Describes an object if supported.
*
* @param OutputInterface $output
* @param object $object
* @param string $format
* @param boolean $raw
*/
public function describe(OutputInterface $output, $object, $format = null, $raw = false, $namespace = null)
{
$options = array('raw_text' => $raw, 'format' => $format ?: 'txt', 'namespace' => $namespace);
$type = !$raw && 'txt' === $options['format'] ? OutputInterface::OUTPUT_NORMAL : OutputInterface::OUTPUT_RAW;
if (!isset($this->descriptors[$options['format']])) {
throw new \InvalidArgumentException(sprintf('Unsupported format "%s".', $options['format']));
}
$descriptor = $this->descriptors[$options['format']];
$output->writeln($descriptor->describe($object, $options), $type);
}
/**
* Registers a descriptor.
*
* @param string $format
* @param DescriptorInterface $descriptor
*
* @return DescriptorHelper
*/
public function register($format, DescriptorInterface $descriptor)
{
$this->descriptors[$format] = $descriptor;
return $this;
}
/**
* {@inheritdoc}
*/
public function getName()
{
return 'descriptor';
}
}

@ -34,12 +34,13 @@ class DialogHelper extends Helper
* @param Boolean $default The default answer if the user enters nothing
* @param Boolean|integer $attempts Max number of times to ask before giving up (false by default, which means infinite)
* @param string $errorMessage Message which will be shown if invalid value from choice list would be picked
* @param Boolean $multiselect Select more than one value separated by comma
*
* @return integer|string The selected value (the key of the choices array)
* @return integer|string|array The selected value or values (the key of the choices array)
*
* @throws \InvalidArgumentException
*/
public function select(OutputInterface $output, $question, $choices, $default = null, $attempts = false, $errorMessage = 'Value "%s" is invalid')
public function select(OutputInterface $output, $question, $choices, $default = null, $attempts = false, $errorMessage = 'Value "%s" is invalid', $multiselect = false)
{
$width = max(array_map('strlen', array_keys($choices)));
@ -50,11 +51,33 @@ class DialogHelper extends Helper
$output->writeln($messages);
$result = $this->askAndValidate($output, '> ', function ($picked) use ($choices, $errorMessage) {
if (empty($choices[$picked])) {
throw new \InvalidArgumentException(sprintf($errorMessage, $picked));
$result = $this->askAndValidate($output, '> ', function ($picked) use ($choices, $errorMessage, $multiselect) {
// Collapse all spaces.
$selectedChoices = str_replace(" ", "", $picked);
if ($multiselect) {
// Check for a separated comma values
if(!preg_match('/^[a-zA-Z0-9_-]+(?:,[a-zA-Z0-9_-]+)*$/', $selectedChoices, $matches)) {
throw new \InvalidArgumentException(sprintf($errorMessage, $picked));
}
$selectedChoices = explode(",", $selectedChoices);
} else {
$selectedChoices = array($picked);
}
$multiselectChoices = array();
foreach ($selectedChoices as $value) {
if (empty($choices[$value])) {
throw new \InvalidArgumentException(sprintf($errorMessage, $value));
}
array_push($multiselectChoices, $value);
}
if ($multiselect){
return $multiselectChoices;
}
return $picked;
}, $attempts, $default);
@ -102,7 +125,9 @@ class DialogHelper extends Helper
$output->getFormatter()->setStyle('hl', new OutputFormatterStyle('black', 'white'));
// Read a keypress
while ($c = fread($inputStream, 1)) {
while (!feof($inputStream)) {
$c = fread($inputStream, 1);
// Backspace Character
if ("\177" === $c) {
if (0 === $numMatches && 0 !== $i) {

@ -196,6 +196,8 @@ class ProgressHelper extends Helper
}
break;
case OutputInterface::VERBOSITY_VERBOSE:
case OutputInterface::VERBOSITY_VERY_VERBOSE:
case OutputInterface::VERBOSITY_DEBUG:
$this->format = self::FORMAT_VERBOSE_NOMAX;
if ($this->max > 0) {
$this->format = self::FORMAT_VERBOSE;
@ -287,6 +289,18 @@ class ProgressHelper extends Helper
$this->overwrite($this->output, $message);
}
/**
* Removes the progress bar from the current line.
*
* This is useful if you wish to write some output
* while a progress bar is running.
* Call display() to show the progress bar again.
*/
public function clear()
{
$this->overwrite($this->output, '');
}
/**
* Finishes the progress output.
*/
@ -415,7 +429,7 @@ class ProgressHelper extends Helper
* Overwrites a previous message to the output.
*
* @param OutputInterface $output An Output instance
* @param string $messages The message
* @param string $message The message
*/
private function overwrite(OutputInterface $output, $message)
{

@ -215,6 +215,11 @@ class ArgvInput extends Input
$option = $this->definition->getOption($name);
// Convert false values (from a previous call to substr()) to null
if (false === $value) {
$value = null;
}
if (null === $value && $option->acceptValue() && count($this->parsed)) {
// if option accepts an optional or mandatory argument
// let's see if there is one provided
@ -233,7 +238,9 @@ class ArgvInput extends Input
throw new \RuntimeException(sprintf('The "--%s" option requires a value.', $name));
}
$value = $option->isValueOptional() ? $option->getDefault() : true;
if (!$option->isArray()) {
$value = $option->isValueOptional() ? $option->getDefault() : true;
}
}
if ($option->isArray()) {

@ -11,6 +11,9 @@
namespace Symfony\Component\Console\Input;
use Symfony\Component\Console\Descriptor\TextDescriptor;
use Symfony\Component\Console\Descriptor\XmlDescriptor;
/**
* A InputDefinition represents a set of valid command line arguments and options.
*
@ -150,12 +153,12 @@ class InputDefinition
*/
public function getArgument($name)
{
$arguments = is_int($name) ? array_values($this->arguments) : $this->arguments;
if (!$this->hasArgument($name)) {
throw new \InvalidArgumentException(sprintf('The "%s" argument does not exist.', $name));
}
$arguments = is_int($name) ? array_values($this->arguments) : $this->arguments;
return $arguments[$name];
}
@ -263,13 +266,21 @@ class InputDefinition
{
if (isset($this->options[$option->getName()]) && !$option->equals($this->options[$option->getName()])) {
throw new \LogicException(sprintf('An option named "%s" already exists.', $option->getName()));
} elseif (isset($this->shortcuts[$option->getShortcut()]) && !$option->equals($this->options[$this->shortcuts[$option->getShortcut()]])) {
throw new \LogicException(sprintf('An option with shortcut "%s" already exists.', $option->getShortcut()));
}
if ($option->getShortcut()) {
foreach (explode('|', $option->getShortcut()) as $shortcut) {
if (isset($this->shortcuts[$shortcut]) && !$option->equals($this->options[$this->shortcuts[$shortcut]])) {
throw new \LogicException(sprintf('An option with shortcut "%s" already exists.', $shortcut));
}
}
}
$this->options[$option->getName()] = $option;
if ($option->getShortcut()) {
$this->shortcuts[$option->getShortcut()] = $option->getName();
foreach (explode('|', $option->getShortcut()) as $shortcut) {
$this->shortcuts[$shortcut] = $option->getName();
}
}
}
@ -404,70 +415,14 @@ class InputDefinition
* Returns a textual representation of the InputDefinition.
*
* @return string A string representing the InputDefinition
*
* @deprecated Deprecated since version 2.3, to be removed in 3.0.
*/
public function asText()
{
// find the largest option or argument name
$max = 0;
foreach ($this->getOptions() as $option) {
$nameLength = strlen($option->getName()) + 2;
if ($option->getShortcut()) {
$nameLength += strlen($option->getShortcut()) + 3;
}
$max = max($max, $nameLength);
}
foreach ($this->getArguments() as $argument) {
$max = max($max, strlen($argument->getName()));
}
++$max;
$text = array();
if ($this->getArguments()) {
$text[] = '<comment>Arguments:</comment>';
foreach ($this->getArguments() as $argument) {
if (null !== $argument->getDefault() && (!is_array($argument->getDefault()) || count($argument->getDefault()))) {
$default = sprintf('<comment> (default: %s)</comment>', $this->formatDefaultValue($argument->getDefault()));
} else {
$default = '';
}
$description = str_replace("\n", "\n".str_repeat(' ', $max + 2), $argument->getDescription());
$text[] = sprintf(" <info>%-${max}s</info> %s%s", $argument->getName(), $description, $default);
}
$descriptor = new TextDescriptor();
$text[] = '';
}
if ($this->getOptions()) {
$text[] = '<comment>Options:</comment>';
foreach ($this->getOptions() as $option) {
if ($option->acceptValue() && null !== $option->getDefault() && (!is_array($option->getDefault()) || count($option->getDefault()))) {
$default = sprintf('<comment> (default: %s)</comment>', $this->formatDefaultValue($option->getDefault()));
} else {
$default = '';
}
$multiple = $option->isArray() ? '<comment> (multiple values allowed)</comment>' : '';
$description = str_replace("\n", "\n".str_repeat(' ', $max + 2), $option->getDescription());
$optionMax = $max - strlen($option->getName()) - 2;
$text[] = sprintf(" <info>%s</info> %-${optionMax}s%s%s%s",
'--'.$option->getName(),
$option->getShortcut() ? sprintf('(-%s) ', $option->getShortcut()) : '',
$description,
$default,
$multiple
);
}
$text[] = '';
}
return implode("\n", $text);
return $descriptor->describe($this);
}
/**
@ -475,61 +430,14 @@ class InputDefinition
*
* @param Boolean $asDom Whether to return a DOM or an XML string
*
* @return string|DOMDocument An XML string representing the InputDefinition
* @return string|\DOMDocument An XML string representing the InputDefinition
*
* @deprecated Deprecated since version 2.3, to be removed in 3.0.
*/
public function asXml($asDom = false)
{
$dom = new \DOMDocument('1.0', 'UTF-8');
$dom->formatOutput = true;
$dom->appendChild($definitionXML = $dom->createElement('definition'));
$definitionXML->appendChild($argumentsXML = $dom->createElement('arguments'));
foreach ($this->getArguments() as $argument) {
$argumentsXML->appendChild($argumentXML = $dom->createElement('argument'));
$argumentXML->setAttribute('name', $argument->getName());
$argumentXML->setAttribute('is_required', $argument->isRequired() ? 1 : 0);
$argumentXML->setAttribute('is_array', $argument->isArray() ? 1 : 0);
$argumentXML->appendChild($descriptionXML = $dom->createElement('description'));
$descriptionXML->appendChild($dom->createTextNode($argument->getDescription()));
$argumentXML->appendChild($defaultsXML = $dom->createElement('defaults'));
$defaults = is_array($argument->getDefault()) ? $argument->getDefault() : (is_bool($argument->getDefault()) ? array(var_export($argument->getDefault(), true)) : ($argument->getDefault() ? array($argument->getDefault()) : array()));
foreach ($defaults as $default) {
$defaultsXML->appendChild($defaultXML = $dom->createElement('default'));
$defaultXML->appendChild($dom->createTextNode($default));
}
}
$definitionXML->appendChild($optionsXML = $dom->createElement('options'));
foreach ($this->getOptions() as $option) {
$optionsXML->appendChild($optionXML = $dom->createElement('option'));
$optionXML->setAttribute('name', '--'.$option->getName());
$optionXML->setAttribute('shortcut', $option->getShortcut() ? '-'.$option->getShortcut() : '');
$optionXML->setAttribute('accept_value', $option->acceptValue() ? 1 : 0);
$optionXML->setAttribute('is_value_required', $option->isValueRequired() ? 1 : 0);
$optionXML->setAttribute('is_multiple', $option->isArray() ? 1 : 0);
$optionXML->appendChild($descriptionXML = $dom->createElement('description'));
$descriptionXML->appendChild($dom->createTextNode($option->getDescription()));
if ($option->acceptValue()) {
$optionXML->appendChild($defaultsXML = $dom->createElement('defaults'));
$defaults = is_array($option->getDefault()) ? $option->getDefault() : (is_bool($option->getDefault()) ? array(var_export($option->getDefault(), true)) : ($option->getDefault() ? array($option->getDefault()) : array()));
foreach ($defaults as $default) {
$defaultsXML->appendChild($defaultXML = $dom->createElement('default'));
$defaultXML->appendChild($dom->createTextNode($default));
}
}
}
return $asDom ? $dom : $dom->saveXml();
}
private function formatDefaultValue($default)
{
if (version_compare(PHP_VERSION, '5.4', '<')) {
return str_replace('\/', '/', json_encode($default));
}
$descriptor = new XmlDescriptor();
return json_encode($default, JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE);
return $descriptor->describe($this, array('as_dom' => $asDom));
}
}

@ -34,11 +34,11 @@ class InputOption
/**
* Constructor.
*
* @param string $name The option name
* @param string $shortcut The shortcut (can be null)
* @param integer $mode The option mode: One of the VALUE_* constants
* @param string $description A description text
* @param mixed $default The default value (must be null for self::VALUE_REQUIRED or self::VALUE_NONE)
* @param string $name The option name
* @param string|array $shortcut The shortcuts, can be null, a string of shortcuts delimited by | or an array of shortcuts
* @param integer $mode The option mode: One of the VALUE_* constants
* @param string $description A description text
* @param mixed $default The default value (must be null for self::VALUE_REQUIRED or self::VALUE_NONE)
*
* @throws \InvalidArgumentException If option mode is invalid or incompatible
*
@ -59,9 +59,12 @@ class InputOption
}
if (null !== $shortcut) {
if ('-' === $shortcut[0]) {
$shortcut = substr($shortcut, 1);
if (is_array($shortcut)) {
$shortcut = implode('|', $shortcut);
}
$shortcuts = preg_split('{(\|)-?}', ltrim($shortcut, '-'));
$shortcuts = array_filter($shortcuts);
$shortcut = implode('|', $shortcuts);
if (empty($shortcut)) {
throw new \InvalidArgumentException('An option shortcut cannot be empty.');

@ -36,10 +36,9 @@ class ConsoleOutput extends StreamOutput implements ConsoleOutputInterface
/**
* Constructor.
*
* @param integer $verbosity The verbosity level (self::VERBOSITY_QUIET, self::VERBOSITY_NORMAL,
* self::VERBOSITY_VERBOSE)
* @param Boolean $decorated Whether to decorate messages or not (null for auto-guessing)
* @param OutputFormatterInterface $formatter Output formatter instance
* @param integer $verbosity The verbosity level (one of the VERBOSITY constants in OutputInterface)
* @param Boolean|null $decorated Whether to decorate messages (null for auto-guessing)
* @param OutputFormatterInterface|null $formatter Output formatter instance (null to use default OutputFormatter)
*
* @api
*/
@ -55,18 +54,27 @@ class ConsoleOutput extends StreamOutput implements ConsoleOutputInterface
$this->stderr = new StreamOutput(fopen('php://stderr', 'w'), $verbosity, $decorated, $formatter);
}
/**
* {@inheritdoc}
*/
public function setDecorated($decorated)
{
parent::setDecorated($decorated);
$this->stderr->setDecorated($decorated);
}
/**
* {@inheritdoc}
*/
public function setFormatter(OutputFormatterInterface $formatter)
{
parent::setFormatter($formatter);
$this->stderr->setFormatter($formatter);
}
/**
* {@inheritdoc}
*/
public function setVerbosity($level)
{
parent::setVerbosity($level);
@ -74,13 +82,16 @@ class ConsoleOutput extends StreamOutput implements ConsoleOutputInterface
}
/**
* @return OutputInterface
* {@inheritdoc}
*/
public function getErrorOutput()
{
return $this->stderr;
}
/**
* {@inheritdoc}
*/
public function setErrorOutput(OutputInterface $error)
{
$this->stderr = $error;

@ -22,9 +22,16 @@ use Symfony\Component\Console\Output\OutputInterface;
interface ConsoleOutputInterface extends OutputInterface
{
/**
* Gets the OutputInterface for errors.
*
* @return OutputInterface
*/
public function getErrorOutput();
/**
* Sets the OutputInterface used for errors.
*
* @param OutputInterface $error
*/
public function setErrorOutput(OutputInterface $error);
}

@ -11,24 +11,83 @@
namespace Symfony\Component\Console\Output;
use Symfony\Component\Console\Formatter\OutputFormatter;
use Symfony\Component\Console\Formatter\OutputFormatterInterface;
/**
* NullOutput suppresses all output.
*
* $output = new NullOutput();
*
* @author Fabien Potencier <fabien@symfony.com>
* @author Tobias Schultze <http://tobion.de>
*
* @api
*/
class NullOutput extends Output
class NullOutput implements OutputInterface
{
/**
* Writes a message to the output.
*
* @param string $message A message to write to the output
* @param Boolean $newline Whether to add a newline or not
* {@inheritdoc}
*/
public function setFormatter(OutputFormatterInterface $formatter)
{
// do nothing
}
/**
* {@inheritdoc}
*/
public function getFormatter()
{
// to comply with the interface we must return a OutputFormatterInterface
return new OutputFormatter();
}
/**
* {@inheritdoc}
*/
public function setDecorated($decorated)
{
// do nothing
}
/**
* {@inheritdoc}
*/
public function isDecorated()
{
return false;
}
/**
* {@inheritdoc}
*/
public function setVerbosity($level)
{
// do nothing
}
/**
* {@inheritdoc}
*/
public function getVerbosity()
{
return self::VERBOSITY_QUIET;
}
/**
* {@inheritdoc}
*/
public function writeln($messages, $type = self::OUTPUT_NORMAL)
{
// do nothing
}
/**
* {@inheritdoc}
*/
protected function doWrite($message, $newline)
public function write($messages, $newline = false, $type = self::OUTPUT_NORMAL)
{
// do nothing
}
}

@ -17,10 +17,12 @@ use Symfony\Component\Console\Formatter\OutputFormatter;
/**
* Base class for output classes.
*
* There are three levels of verbosity:
* There are five levels of verbosity:
*
* * normal: no option passed (normal output - information)
* * verbose: -v (more output - debug)
* * normal: no option passed (normal output)
* * verbose: -v (more output)
* * very verbose: -vv (highly extended output)
* * debug: -vvv (all debug output)
* * quiet: -q (no output)
*
* @author Fabien Potencier <fabien@symfony.com>
@ -35,25 +37,21 @@ abstract class Output implements OutputInterface
/**
* Constructor.
*
* @param integer $verbosity The verbosity level (self::VERBOSITY_QUIET, self::VERBOSITY_NORMAL, self::VERBOSITY_VERBOSE)
* @param Boolean $decorated Whether to decorate messages or not (null for auto-guessing)
* @param OutputFormatterInterface $formatter Output formatter instance
* @param integer $verbosity The verbosity level (one of the VERBOSITY constants in OutputInterface)
* @param Boolean $decorated Whether to decorate messages
* @param OutputFormatterInterface|null $formatter Output formatter instance (null to use default OutputFormatter)
*
* @api
*/
public function __construct($verbosity = self::VERBOSITY_NORMAL, $decorated = null, OutputFormatterInterface $formatter = null)
public function __construct($verbosity = self::VERBOSITY_NORMAL, $decorated = false, OutputFormatterInterface $formatter = null)
{
$this->verbosity = null === $verbosity ? self::VERBOSITY_NORMAL : $verbosity;
$this->formatter = null === $formatter ? new OutputFormatter() : $formatter;
$this->formatter->setDecorated((Boolean) $decorated);
$this->formatter->setDecorated($decorated);
}
/**
* Sets output formatter.
*
* @param OutputFormatterInterface $formatter
*
* @api
* {@inheritdoc}
*/
public function setFormatter(OutputFormatterInterface $formatter)
{
@ -61,11 +59,7 @@ abstract class Output implements OutputInterface
}
/**
* Returns current output formatter instance.
*
* @return OutputFormatterInterface
*
* @api
* {@inheritdoc}
*/
public function getFormatter()
{
@ -73,23 +67,15 @@ abstract class Output implements OutputInterface
}
/**
* Sets the decorated flag.
*
* @param Boolean $decorated Whether to decorate the messages or not
*
* @api
* {@inheritdoc}
*/
public function setDecorated($decorated)
{
$this->formatter->setDecorated((Boolean) $decorated);
$this->formatter->setDecorated($decorated);
}
/**
* Gets the decorated flag.
*
* @return Boolean true if the output will decorate messages, false otherwise
*
* @api
* {@inheritdoc}
*/
public function isDecorated()
{
@ -97,11 +83,7 @@ abstract class Output implements OutputInterface
}
/**
* Sets the verbosity of the output.
*
* @param integer $level The level of verbosity
*
* @api
* {@inheritdoc}
*/
public function setVerbosity($level)
{
@ -109,11 +91,7 @@ abstract class Output implements OutputInterface
}
/**
* Gets the current verbosity of the output.
*
* @return integer The current level of verbosity
*
* @api
* {@inheritdoc}
*/
public function getVerbosity()
{
@ -121,30 +99,17 @@ abstract class Output implements OutputInterface
}
/**
* Writes a message to the output and adds a newline at the end.
*
* @param string|array $messages The message as an array of lines or a single string
* @param integer $type The type of output
*
* @api
* {@inheritdoc}
*/
public function writeln($messages, $type = 0)
public function writeln($messages, $type = self::OUTPUT_NORMAL)
{
$this->write($messages, true, $type);
}
/**
* Writes a message to the output.
*
* @param string|array $messages The message as an array of lines or a single string
* @param Boolean $newline Whether to add a newline or not
* @param integer $type The type of output
*
* @throws \InvalidArgumentException When unknown output type is given
*
* @api
* {@inheritdoc}
*/
public function write($messages, $newline = false, $type = 0)
public function write($messages, $newline = false, $type = self::OUTPUT_NORMAL)
{
if (self::VERBOSITY_QUIET === $this->verbosity) {
return;

@ -22,41 +22,45 @@ use Symfony\Component\Console\Formatter\OutputFormatterInterface;
*/
interface OutputInterface
{
const VERBOSITY_QUIET = 0;
const VERBOSITY_NORMAL = 1;
const VERBOSITY_VERBOSE = 2;
const VERBOSITY_QUIET = 0;
const VERBOSITY_NORMAL = 1;
const VERBOSITY_VERBOSE = 2;
const VERBOSITY_VERY_VERBOSE = 3;
const VERBOSITY_DEBUG = 4;
const OUTPUT_NORMAL = 0;
const OUTPUT_RAW = 1;
const OUTPUT_PLAIN = 2;
const OUTPUT_RAW = 1;
const OUTPUT_PLAIN = 2;
/**
* Writes a message to the output.
*
* @param string|array $messages The message as an array of lines or a single string
* @param Boolean $newline Whether to add a newline or not
* @param integer $type The type of output (0: normal, 1: raw, 2: plain)
* @param Boolean $newline Whether to add a newline
* @param integer $type The type of output (one of the OUTPUT constants)
*
* @throws \InvalidArgumentException When unknown output type is given
*
* @api
*/
public function write($messages, $newline = false, $type = 0);
public function write($messages, $newline = false, $type = self::OUTPUT_NORMAL);
/**
* Writes a message to the output and adds a newline at the end.
*
* @param string|array $messages The message as an array of lines of a single string
* @param integer $type The type of output (0: normal, 1: raw, 2: plain)
* @param integer $type The type of output (one of the OUTPUT constants)
*
* @throws \InvalidArgumentException When unknown output type is given
*
* @api
*/
public function writeln($messages, $type = 0);
public function writeln($messages, $type = self::OUTPUT_NORMAL);
/**
* Sets the verbosity of the output.
*
* @param integer $level The level of verbosity
* @param integer $level The level of verbosity (one of the VERBOSITY constants)
*
* @api
*/
@ -65,7 +69,7 @@ interface OutputInterface
/**
* Gets the current verbosity of the output.
*
* @return integer The current level of verbosity
* @return integer The current level of verbosity (one of the VERBOSITY constants)
*
* @api
*/
@ -74,7 +78,7 @@ interface OutputInterface
/**
* Sets the decorated flag.
*
* @param Boolean $decorated Whether to decorate the messages or not
* @param Boolean $decorated Whether to decorate the messages
*
* @api
*/

@ -35,11 +35,10 @@ class StreamOutput extends Output
/**
* Constructor.
*
* @param mixed $stream A stream resource
* @param integer $verbosity The verbosity level (self::VERBOSITY_QUIET, self::VERBOSITY_NORMAL,
* self::VERBOSITY_VERBOSE)
* @param Boolean $decorated Whether to decorate messages or not (null for auto-guessing)
* @param OutputFormatterInterface $formatter Output formatter instance
* @param mixed $stream A stream resource
* @param integer $verbosity The verbosity level (one of the VERBOSITY constants in OutputInterface)
* @param Boolean|null $decorated Whether to decorate messages (null for auto-guessing)
* @param OutputFormatterInterface|null $formatter Output formatter instance (null to use default OutputFormatter)
*
* @throws \InvalidArgumentException When first argument is not a real stream
*
@ -71,12 +70,7 @@ class StreamOutput extends Output
}
/**
* Writes a message to the output.
*
* @param string $message A message to write to the output
* @param Boolean $newline Whether to add a newline or not
*
* @throws \RuntimeException When unable to write output (should never happen)
* {@inheritdoc}
*/
protected function doWrite($message, $newline)
{

@ -32,7 +32,6 @@ class Shell
private $history;
private $output;
private $hasReadline;
private $prompt;
private $processIsolation;
/**
@ -49,7 +48,6 @@ class Shell
$this->application = $application;
$this->history = getenv('HOME').'/.history_'.$application->getName();
$this->output = new ConsoleOutput();
$this->prompt = $application->getName().' > ';
$this->processIsolation = false;
}
@ -141,6 +139,27 @@ To exit the shell, type <comment>^D</comment>.
EOF;
}
/**
* Renders a prompt.
*
* @return string The prompt
*/
protected function getPrompt()
{
// using the formatter here is required when using readline
return $this->output->getFormatter()->format($this->application->getName().' > ');
}
protected function getOutput()
{
return $this->output;
}
protected function getApplication()
{
return $this->application;
}
/**
* Tries to return autocompletion for the current entered text.
*
@ -185,9 +204,9 @@ EOF;
private function readline()
{
if ($this->hasReadline) {
$line = readline($this->prompt);
$line = readline($this->getPrompt());
} else {
$this->output->write($this->prompt);
$this->output->write($this->getPrompt());
$line = fgets(STDIN, 1024);
$line = (!$line && strlen($line) == 0) ? false : rtrim($line);
}

@ -32,6 +32,7 @@ class ApplicationTester
private $application;
private $input;
private $output;
private $statusCode;
/**
* Constructor.
@ -72,7 +73,7 @@ class ApplicationTester
$this->output->setVerbosity($options['verbosity']);
}
return $this->application->run($this->input, $this->output);
return $this->statusCode = $this->application->run($this->input, $this->output);
}
/**
@ -114,4 +115,14 @@ class ApplicationTester
{
return $this->output;
}
/**
* Gets the status code returned by the last execution of the application.
*
* @return integer The status code
*/
public function getStatusCode()
{
return $this->statusCode;
}
}

@ -25,6 +25,7 @@ class CommandTester
private $command;
private $input;
private $output;
private $statusCode;
/**
* Constructor.
@ -65,7 +66,7 @@ class CommandTester
$this->output->setVerbosity($options['verbosity']);
}
return $this->command->run($this->input, $this->output);
return $this->statusCode = $this->command->run($this->input, $this->output);
}
/**
@ -107,4 +108,14 @@ class CommandTester
{
return $this->output;
}
/**
* Gets the status code returned by the last execution of the application.
*
* @return integer The status code
*/
public function getStatusCode()
{
return $this->statusCode;
}
}

@ -24,7 +24,7 @@ use Symfony\Component\Console\Output\Output;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Tester\ApplicationTester;
use Symfony\Component\Console\Event\ConsoleCommandEvent;
use Symfony\Component\Console\Event\ConsoleForExceptionEvent;
use Symfony\Component\Console\Event\ConsoleExceptionEvent;
use Symfony\Component\Console\Event\ConsoleTerminateEvent;
use Symfony\Component\EventDispatcher\EventDispatcher;
@ -146,6 +146,18 @@ class ApplicationTest extends \PHPUnit_Framework_TestCase
$this->assertInstanceOf('Symfony\Component\Console\Command\HelpCommand', $command, '->get() returns the help command if --help is provided as the input');
}
public function testSilentHelp()
{
$application = new Application();
$application->setAutoExit(false);
$application->setCatchExceptions(false);
$tester = new ApplicationTester($application);
$tester->run(array('-h' => true, '-q' => true), array('decorated' => false));
$this->assertEmpty($tester->getDisplay(true));
}
/**
* @expectedException \InvalidArgumentException
* @expectedExceptionMessage The command "foofoo" does not exist.
@ -232,6 +244,16 @@ class ApplicationTest extends \PHPUnit_Framework_TestCase
);
}
public function testFindCommandEqualNamespace()
{
$application = new Application();
$application->add(new \Foo3Command());
$application->add(new \Foo4Command());
$this->assertInstanceOf('Foo3Command', $application->find('foo3:bar'), '->find() returns the good command even if a namespace has same name');
$this->assertInstanceOf('Foo4Command', $application->find('foo3:bar:toh'), '->find() returns a command even if its namespace equals another command name');
}
/**
* @dataProvider provideInvalidCommandNamesSingle
* @expectedException \InvalidArgumentException
@ -502,9 +524,27 @@ class ApplicationTest extends \PHPUnit_Framework_TestCase
$tester->run(array('command' => 'list', '--verbose' => true));
$this->assertSame(Output::VERBOSITY_VERBOSE, $tester->getOutput()->getVerbosity(), '->run() sets the output to verbose if --verbose is passed');
$tester->run(array('command' => 'list', '--verbose' => 1));
$this->assertSame(Output::VERBOSITY_VERBOSE, $tester->getOutput()->getVerbosity(), '->run() sets the output to verbose if --verbose=1 is passed');
$tester->run(array('command' => 'list', '--verbose' => 2));
$this->assertSame(Output::VERBOSITY_VERY_VERBOSE, $tester->getOutput()->getVerbosity(), '->run() sets the output to very verbose if --verbose=2 is passed');
$tester->run(array('command' => 'list', '--verbose' => 3));
$this->assertSame(Output::VERBOSITY_DEBUG, $tester->getOutput()->getVerbosity(), '->run() sets the output to debug if --verbose=3 is passed');
$tester->run(array('command' => 'list', '--verbose' => 4));
$this->assertSame(Output::VERBOSITY_VERBOSE, $tester->getOutput()->getVerbosity(), '->run() sets the output to verbose if unknown --verbose level is passed');
$tester->run(array('command' => 'list', '-v' => true));
$this->assertSame(Output::VERBOSITY_VERBOSE, $tester->getOutput()->getVerbosity(), '->run() sets the output to verbose if -v is passed');
$tester->run(array('command' => 'list', '-vv' => true));
$this->assertSame(Output::VERBOSITY_VERY_VERBOSE, $tester->getOutput()->getVerbosity(), '->run() sets the output to verbose if -v is passed');
$tester->run(array('command' => 'list', '-vvv' => true));
$this->assertSame(Output::VERBOSITY_DEBUG, $tester->getOutput()->getVerbosity(), '->run() sets the output to verbose if -v is passed');
$application = new Application();
$application->setAutoExit(false);
$application->setCatchExceptions(false);
@ -518,6 +558,36 @@ class ApplicationTest extends \PHPUnit_Framework_TestCase
$this->assertSame('called'.PHP_EOL, $tester->getDisplay(), '->run() does not call interact() if -n is passed');
}
public function testRunReturnsIntegerExitCode()
{
$exception = new \Exception('', 4);
$application = $this->getMock('Symfony\Component\Console\Application', array('doRun'));
$application->setAutoExit(false);
$application->expects($this->once())
->method('doRun')
->will($this->throwException($exception));
$exitCode = $application->run(new ArrayInput(array()), new NullOutput());
$this->assertSame(4, $exitCode, '->run() returns integer exit code extracted from raised exception');
}
public function testRunReturnsExitCodeOneForExceptionCodeZero()
{
$exception = new \Exception('', 0);
$application = $this->getMock('Symfony\Component\Console\Application', array('doRun'));
$application->setAutoExit(false);
$application->expects($this->once())
->method('doRun')
->will($this->throwException($exception));
$exitCode = $application->run(new ArrayInput(array()), new NullOutput());
$this->assertSame(1, $exitCode, '->run() returns exit code 1 when exception code is 0');
}
/**
* @expectedException \LogicException
* @dataProvider getAddingAlreadySetDefinitionElementData
@ -733,7 +803,7 @@ class ApplicationTest extends \PHPUnit_Framework_TestCase
$event->setExitCode(128);
});
$dispatcher->addListener('console.exception', function (ConsoleForExceptionEvent $event) {
$dispatcher->addListener('console.exception', function (ConsoleExceptionEvent $event) {
$event->getOutput()->writeln('caught.');
$event->setException(new \LogicException('caught.', $event->getExitCode(), $event->getException()));

@ -198,6 +198,29 @@ class CommandTest extends \PHPUnit_Framework_TestCase
$this->assertEquals(3, $command->getDefinition()->getArgumentCount(), '->mergeApplicationDefinition() does not try to merge twice the application arguments and options');
}
public function testMergeApplicationDefinitionWithoutArgsThenWithArgsAddsArgs()
{
$application1 = new Application();
$application1->getDefinition()->addArguments(array(new InputArgument('foo')));
$application1->getDefinition()->addOptions(array(new InputOption('bar')));
$command = new \TestCommand();
$command->setApplication($application1);
$command->setDefinition($definition = new InputDefinition(array()));
$r = new \ReflectionObject($command);
$m = $r->getMethod('mergeApplicationDefinition');
$m->setAccessible(true);
$m->invoke($command, false);
$this->assertTrue($command->getDefinition()->hasOption('bar'), '->mergeApplicationDefinition(false) merges the application and the commmand options');
$this->assertFalse($command->getDefinition()->hasArgument('foo'), '->mergeApplicationDefinition(false) does not merge the application arguments');
$m->invoke($command, true);
$this->assertTrue($command->getDefinition()->hasArgument('foo'), '->mergeApplicationDefinition(true) merges the application arguments and the command arguments');
$m->invoke($command);
$this->assertEquals(2, $command->getDefinition()->getArgumentCount(), '->mergeApplicationDefinition() does not try to merge twice the application arguments');
}
public function testRunInteractive()
{
$tester = new CommandTester(new \TestCommand());
@ -237,6 +260,20 @@ class CommandTest extends \PHPUnit_Framework_TestCase
$tester->execute(array('--bar' => true));
}
public function testRunReturnsIntegerExitCode()
{
$command = new \TestCommand();
$exitCode = $command->run(new StringInput(''), new NullOutput());
$this->assertSame(0, $exitCode, '->run() returns integer exit code (treats null as 0)');
$command = $this->getMock('TestCommand', array('execute'));
$command->expects($this->once())
->method('execute')
->will($this->returnValue('2.3'));
$exitCode = $command->run(new StringInput(''), new NullOutput());
$this->assertSame(2, $exitCode, '->run() returns integer exit code (casts numeric to int)');
}
public function testRunReturnsAlwaysInteger()
{
$command = new \TestCommand();

@ -24,8 +24,7 @@ class HelpCommandTest extends \PHPUnit_Framework_TestCase
$command->setApplication(new Application());
$commandTester = new CommandTester($command);
$commandTester->execute(array('command_name' => 'li'));
$this->assertRegExp('/list \[--xml\] \[--raw\] \[namespace\]/', $commandTester->getDisplay(), '->execute() returns a text help for the given command alias');
$this->assertRegExp('/list \[--xml\] \[--raw\] \[--format="\.\.\."\] \[namespace\]/', $commandTester->getDisplay(), '->execute() returns a text help for the given command alias');
}
public function testExecuteForCommand()
@ -34,8 +33,7 @@ class HelpCommandTest extends \PHPUnit_Framework_TestCase
$commandTester = new CommandTester($command);
$command->setCommand(new ListCommand());
$commandTester->execute(array());
$this->assertRegExp('/list \[--xml\] \[--raw\] \[namespace\]/', $commandTester->getDisplay(), '->execute() returns a text help for the given command');
$this->assertRegExp('/list \[--xml\] \[--raw\] \[--format="\.\.\."\] \[namespace\]/', $commandTester->getDisplay(), '->execute() returns a text help for the given command');
}
public function testExecuteForCommandWithXmlOption()
@ -43,8 +41,7 @@ class HelpCommandTest extends \PHPUnit_Framework_TestCase
$command = new HelpCommand();
$commandTester = new CommandTester($command);
$command->setCommand(new ListCommand());
$commandTester->execute(array('--xml' => true));
$commandTester->execute(array('--format' => 'xml'));
$this->assertRegExp('/<command/', $commandTester->getDisplay(), '->execute() returns an XML help text if --xml is passed');
}
@ -53,16 +50,16 @@ class HelpCommandTest extends \PHPUnit_Framework_TestCase
$application = new Application();
$commandTester = new CommandTester($application->get('help'));
$commandTester->execute(array('command_name' => 'list'));
$this->assertRegExp('/list \[--xml\] \[--raw\] \[namespace\]/', $commandTester->getDisplay(), '->execute() returns a text help for the given command');
$this->assertRegExp('/list \[--xml\] \[--raw\] \[--format="\.\.\."\] \[namespace\]/', $commandTester->getDisplay(), '->execute() returns a text help for the given command');
}
public function testExecuteForApplicationCommandWithXmlOption()
{
$application = new Application();
$commandTester = new CommandTester($application->get('help'));
$commandTester->execute(array('command_name' => 'list', '--xml' => true));
$this->assertRegExp('/<command/', $commandTester->getDisplay(), '->execute() returns an XML help text if --xml is passed');
$commandTester->execute(array('command_name' => 'list', '--format' => 'xml'));
$this->assertRegExp('/list \[--xml\] \[--raw\] \[--format="\.\.\."\] \[namespace\]/', $commandTester->getDisplay(), '->execute() returns a text help for the given command');
$this->assertRegExp('/<command/', $commandTester->getDisplay(), '->execute() returns an XML help text if --format=xml is passed');
}
}

@ -29,8 +29,7 @@ class ListCommandTest extends \PHPUnit_Framework_TestCase
{
$application = new Application();
$commandTester = new CommandTester($command = $application->get('list'));
$commandTester->execute(array('command' => $command->getName(), '--xml' => true));
$commandTester->execute(array('command' => $command->getName(), '--format' => 'xml'));
$this->assertRegExp('/<command id="list" name="list">/', $commandTester->getDisplay(), '->execute() returns a list of available commands in XML if --xml is passed');
}
@ -45,6 +44,22 @@ list Lists commands
EOF;
$this->assertEquals(str_replace("\n", PHP_EOL, $output), $commandTester->getDisplay());
$this->assertEquals($output, $commandTester->getDisplay(true));
}
public function testExecuteListsCommandsWithNamespaceArgument()
{
require_once(realpath(__DIR__.'/../Fixtures/FooCommand.php'));
$application = new Application();
$application->add(new \FooCommand());
$commandTester = new CommandTester($command = $application->get('list'));
$commandTester->execute(array('command' => $command->getName(), 'namespace' => 'foo', '--raw' => true));
$output = <<<EOF
foo:bar The foo:bar command
EOF;
$this->assertEquals($output, $commandTester->getDisplay(true));
}
}

@ -0,0 +1,98 @@
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Console\Tests\Descriptor;
use Symfony\Component\Console\Application;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Descriptor\DescriptorInterface;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputDefinition;
use Symfony\Component\Console\Input\InputOption;
abstract class AbstractDescriptorTest extends \PHPUnit_Framework_TestCase
{
/** @dataProvider getDescribeInputArgumentTestData */
public function testDescribeInputArgument(InputArgument $argument, $expectedDescription)
{
$this->assertEquals(trim($expectedDescription), trim($this->getDescriptor()->describe($argument)));
}
/** @dataProvider getDescribeInputOptionTestData */
public function testDescribeInputOption(InputOption $option, $expectedDescription)
{
$this->assertEquals(trim($expectedDescription), trim($this->getDescriptor()->describe($option)));
}
/** @dataProvider getDescribeInputDefinitionTestData */
public function testDescribeInputDefinition(InputDefinition $definition, $expectedDescription)
{
$this->assertEquals(trim($expectedDescription), trim($this->getDescriptor()->describe($definition)));
}
/** @dataProvider getDescribeCommandTestData */
public function testDescribeCommand(Command $command, $expectedDescription)
{
$this->assertEquals(trim($expectedDescription), trim($this->getDescriptor()->describe($command)));
}
/** @dataProvider getDescribeApplicationTestData */
public function testDescribeApplication(Application $application, $expectedDescription)
{
// Replaces the dynamic placeholders of the command help text with a static version.
// The placeholder %command.full_name% includes the script path that is not predictable
// and can not be tested against.
foreach ($application->all() as $command) {
$command->setHelp(str_replace('%command.full_name%', 'app/console %command.name%', $command->getHelp()));
}
$this->assertEquals(trim($expectedDescription), trim(str_replace(PHP_EOL, "\n", $this->getDescriptor()->describe($application))));
}
public function getDescribeInputArgumentTestData()
{
return $this->getDescriptionTestData(ObjectsProvider::getInputArguments());
}
public function getDescribeInputOptionTestData()
{
return $this->getDescriptionTestData(ObjectsProvider::getInputOptions());
}
public function getDescribeInputDefinitionTestData()
{
return $this->getDescriptionTestData(ObjectsProvider::getInputDefinitions());
}
public function getDescribeCommandTestData()
{
return $this->getDescriptionTestData(ObjectsProvider::getCommands());
}
public function getDescribeApplicationTestData()
{
return $this->getDescriptionTestData(ObjectsProvider::getApplications());
}
abstract protected function getDescriptor();
abstract protected function getFormat();
private function getDescriptionTestData(array $objects)
{
$data = array();
foreach ($objects as $name => $object) {
$description = file_get_contents(sprintf('%s/../Fixtures/%s.%s', __DIR__, $name, $this->getFormat()));
$data[] = array($object, $description);
}
return $data;
}
}

@ -0,0 +1,27 @@
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Console\Tests\Descriptor;
use Symfony\Component\Console\Descriptor\JsonDescriptor;
class JsonDescriptorTest extends AbstractDescriptorTest
{
protected function getDescriptor()
{
return new JsonDescriptor();
}
protected function getFormat()
{
return 'json';
}
}

@ -0,0 +1,27 @@
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Console\Tests\Descriptor;
use Symfony\Component\Console\Descriptor\MarkdownDescriptor;
class MarkdownDescriptorTest extends AbstractDescriptorTest
{
protected function getDescriptor()
{
return new MarkdownDescriptor();
}
protected function getFormat()
{
return 'md';
}
}

@ -0,0 +1,75 @@
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Console\Tests\Descriptor;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputDefinition;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Tests\Fixtures\DescriptorApplication1;
use Symfony\Component\Console\Tests\Fixtures\DescriptorApplication2;
use Symfony\Component\Console\Tests\Fixtures\DescriptorCommand1;
use Symfony\Component\Console\Tests\Fixtures\DescriptorCommand2;
use Symfony\Component\Finder\Shell\Command;
/**
* @author Jean-François Simon <contact@jfsimon.fr>
*/
class ObjectsProvider
{
public static function getInputArguments()
{
return array(
'input_argument_1' => new InputArgument('argument_name', InputArgument::REQUIRED),
'input_argument_2' => new InputArgument('argument_name', InputArgument::IS_ARRAY, 'argument description'),
'input_argument_3' => new InputArgument('argument_name', InputArgument::OPTIONAL, 'argument description', 'default_value'),
);
}
public static function getInputOptions()
{
return array(
'input_option_1' => new InputOption('option_name', 'o', InputOption::VALUE_NONE),
'input_option_2' => new InputOption('option_name', 'o', InputOption::VALUE_OPTIONAL, 'option description', 'default_value'),
'input_option_3' => new InputOption('option_name', 'o', InputOption::VALUE_REQUIRED, 'option description'),
'input_option_4' => new InputOption('option_name', 'o', InputOption::VALUE_IS_ARRAY | InputOption::VALUE_OPTIONAL, 'option description', array()),
);
}
public static function getInputDefinitions()
{
return array(
'input_definition_1' => new InputDefinition(),
'input_definition_2' => new InputDefinition(array(new InputArgument('argument_name', InputArgument::REQUIRED))),
'input_definition_3' => new InputDefinition(array(new InputOption('option_name', 'o', InputOption::VALUE_NONE))),
'input_definition_4' => new InputDefinition(array(
new InputArgument('argument_name', InputArgument::REQUIRED),
new InputOption('option_name', 'o', InputOption::VALUE_NONE),
)),
);
}
public static function getCommands()
{
return array(
'command_1' => new DescriptorCommand1(),
'command_2' => new DescriptorCommand2(),
);
}
public static function getApplications()
{
return array(
'application_1' => new DescriptorApplication1(),
'application_2' => new DescriptorApplication2(),
);
}
}

@ -0,0 +1,27 @@
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Console\Tests\Descriptor;
use Symfony\Component\Console\Descriptor\TextDescriptor;
class TextDescriptorTest extends AbstractDescriptorTest
{
protected function getDescriptor()
{
return new TextDescriptor();
}
protected function getFormat()
{
return 'txt';
}
}

@ -0,0 +1,27 @@
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Console\Tests\Descriptor;
use Symfony\Component\Console\Descriptor\XmlDescriptor;
class XmlDescriptorTest extends AbstractDescriptorTest
{
protected function getDescriptor()
{
return new XmlDescriptor();
}
protected function getFormat()
{
return 'xml';
}
}

@ -0,0 +1,18 @@
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Console\Tests\Fixtures;
use Symfony\Component\Console\Application;
class DescriptorApplication1 extends Application
{
}

@ -0,0 +1,24 @@
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Console\Tests\Fixtures;
use Symfony\Component\Console\Application;
class DescriptorApplication2 extends Application
{
public function __construct()
{
parent::__construct('My Symfony application', 'v1.0');
$this->add(new DescriptorCommand1());
$this->add(new DescriptorCommand2());
}
}

@ -0,0 +1,27 @@
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Console\Tests\Fixtures;
use Symfony\Component\Console\Command\Command;
class DescriptorCommand1 extends Command
{
protected function configure()
{
$this
->setName('descriptor:command1')
->setAliases(array('alias1', 'alias2'))
->setDescription('command 1 description')
->setHelp('command 1 help')
;
}
}

@ -0,0 +1,30 @@
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Console\Tests\Fixtures;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputOption;
class DescriptorCommand2 extends Command
{
protected function configure()
{
$this
->setName('descriptor:command2')
->setDescription('command 2 description')
->setHelp('command 2 help')
->addArgument('argument_name', InputArgument::REQUIRED)
->addOption('option_name', 'o', InputOption::VALUE_NONE)
;
}
}

@ -0,0 +1 @@
{"commands":[{"name":"help","usage":"help [--xml] [--format=\"...\"] [--raw] [command_name]","description":"Displays help for a command","help":"The <info>help<\/info> command displays help for a given command:\n\n <info>php app\/console help list<\/info>\n\nYou can also output the help in other formats by using the <comment>--format<\/comment> option:\n\n <info>php app\/console help --format=xml list<\/info>\n\nTo display the list of available commands, please use the <info>list<\/info> command.","aliases":[],"definition":{"arguments":{"command_name":{"name":"command_name","is_required":false,"is_array":false,"description":"The command name","default":"help"}},"options":{"xml":{"name":"--xml","shortcut":"","accept_value":false,"is_value_required":false,"is_multiple":false,"description":"To output help as XML","default":false},"format":{"name":"--format","shortcut":"","accept_value":true,"is_value_required":true,"is_multiple":false,"description":"To output help in other formats","default":null},"raw":{"name":"--raw","shortcut":"","accept_value":false,"is_value_required":false,"is_multiple":false,"description":"To output raw command help","default":false},"help":{"name":"--help","shortcut":"-h","accept_value":false,"is_value_required":false,"is_multiple":false,"description":"Display this help message.","default":false},"quiet":{"name":"--quiet","shortcut":"-q","accept_value":false,"is_value_required":false,"is_multiple":false,"description":"Do not output any message.","default":false},"verbose":{"name":"--verbose","shortcut":"-v|-vv|-vvv","accept_value":false,"is_value_required":false,"is_multiple":false,"description":"Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug","default":false},"version":{"name":"--version","shortcut":"-V","accept_value":false,"is_value_required":false,"is_multiple":false,"description":"Display this application version.","default":false},"ansi":{"name":"--ansi","shortcut":"","accept_value":false,"is_value_required":false,"is_multiple":false,"description":"Force ANSI output.","default":false},"no-ansi":{"name":"--no-ansi","shortcut":"","accept_value":false,"is_value_required":false,"is_multiple":false,"description":"Disable ANSI output.","default":false},"no-interaction":{"name":"--no-interaction","shortcut":"-n","accept_value":false,"is_value_required":false,"is_multiple":false,"description":"Do not ask any interactive question.","default":false}}}},{"name":"list","usage":"list [--xml] [--raw] [--format=\"...\"] [namespace]","description":"Lists commands","help":"The <info>list<\/info> command lists all commands:\n\n <info>php app\/console list<\/info>\n\nYou can also display the commands for a specific namespace:\n\n <info>php app\/console list test<\/info>\n\nYou can also output the information in other formats by using the <comment>--format<\/comment> option:\n\n <info>php app\/console list --format=xml<\/info>\n\nIt's also possible to get raw list of commands (useful for embedding command runner):\n\n <info>php app\/console list --raw<\/info>","aliases":[],"definition":{"arguments":{"namespace":{"name":"namespace","is_required":false,"is_array":false,"description":"The namespace name","default":null}},"options":{"xml":{"name":"--xml","shortcut":"","accept_value":false,"is_value_required":false,"is_multiple":false,"description":"To output list as XML","default":false},"raw":{"name":"--raw","shortcut":"","accept_value":false,"is_value_required":false,"is_multiple":false,"description":"To output raw command list","default":false},"format":{"name":"--format","shortcut":"","accept_value":true,"is_value_required":true,"is_multiple":false,"description":"To output list in other formats","default":null}}}}],"namespaces":[{"id":"_global","commands":["help","list"]}]}

@ -0,0 +1,199 @@
UNKNOWN
=======
* help
* list
help
----
* Description: Displays help for a command
* Usage: `help [--xml] [--format="..."] [--raw] [command_name]`
* Aliases: <none>
The <info>help</info> command displays help for a given command:
<info>php app/console help list</info>
You can also output the help in other formats by using the <comment>--format</comment> option:
<info>php app/console help --format=xml list</info>
To display the list of available commands, please use the <info>list</info> command.
### Arguments:
**command_name:**
* Name: command_name
* Is required: no
* Is array: no
* Description: The command name
* Default: `'help'`
### Options:
**xml:**
* Name: `--xml`
* Shortcut: <none>
* Accept value: no
* Is value required: no
* Is multiple: no
* Description: To output help as XML
* Default: `false`
**format:**
* Name: `--format`
* Shortcut: <none>
* Accept value: yes
* Is value required: yes
* Is multiple: no
* Description: To output help in other formats
* Default: `NULL`
**raw:**
* Name: `--raw`
* Shortcut: <none>
* Accept value: no
* Is value required: no
* Is multiple: no
* Description: To output raw command help
* Default: `false`
**help:**
* Name: `--help`
* Shortcut: `-h`
* Accept value: no
* Is value required: no
* Is multiple: no
* Description: Display this help message.
* Default: `false`
**quiet:**
* Name: `--quiet`
* Shortcut: `-q`
* Accept value: no
* Is value required: no
* Is multiple: no
* Description: Do not output any message.
* Default: `false`
**verbose:**
* Name: `--verbose`
* Shortcut: `-v|-vv|-vvv`
* Accept value: no
* Is value required: no
* Is multiple: no
* Description: Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug
* Default: `false`
**version:**
* Name: `--version`
* Shortcut: `-V`
* Accept value: no
* Is value required: no
* Is multiple: no
* Description: Display this application version.
* Default: `false`
**ansi:**
* Name: `--ansi`
* Shortcut: <none>
* Accept value: no
* Is value required: no
* Is multiple: no
* Description: Force ANSI output.
* Default: `false`
**no-ansi:**
* Name: `--no-ansi`
* Shortcut: <none>
* Accept value: no
* Is value required: no
* Is multiple: no
* Description: Disable ANSI output.
* Default: `false`
**no-interaction:**
* Name: `--no-interaction`
* Shortcut: `-n`
* Accept value: no
* Is value required: no
* Is multiple: no
* Description: Do not ask any interactive question.
* Default: `false`
list
----
* Description: Lists commands
* Usage: `list [--xml] [--raw] [--format="..."] [namespace]`
* Aliases: <none>
The <info>list</info> command lists all commands:
<info>php app/console list</info>
You can also display the commands for a specific namespace:
<info>php app/console list test</info>
You can also output the information in other formats by using the <comment>--format</comment> option:
<info>php app/console list --format=xml</info>
It's also possible to get raw list of commands (useful for embedding command runner):
<info>php app/console list --raw</info>
### Arguments:
**namespace:**
* Name: namespace
* Is required: no
* Is array: no
* Description: The namespace name
* Default: `NULL`
### Options:
**xml:**
* Name: `--xml`
* Shortcut: <none>
* Accept value: no
* Is value required: no
* Is multiple: no
* Description: To output list as XML
* Default: `false`
**raw:**
* Name: `--raw`
* Shortcut: <none>
* Accept value: no
* Is value required: no
* Is multiple: no
* Description: To output raw command list
* Default: `false`
**format:**
* Name: `--format`
* Shortcut: <none>
* Accept value: yes
* Is value required: yes
* Is multiple: no
* Description: To output list in other formats
* Default: `NULL`

@ -0,0 +1,17 @@
<info>Console Tool</info>
<comment>Usage:</comment>
[options] command [arguments]
<comment>Options:</comment>
<info>--help</info> <info>-h</info> Display this help message.
<info>--quiet</info> <info>-q</info> Do not output any message.
<info>--verbose</info> <info>-v|vv|vvv</info> Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug
<info>--version</info> <info>-V</info> Display this application version.
<info>--ansi</info> Force ANSI output.
<info>--no-ansi</info> Disable ANSI output.
<info>--no-interaction</info> <info>-n</info> Do not ask any interactive question.
<comment>Available commands:</comment>
<info>help </info> Displays help for a command
<info>list </info> Lists commands

@ -0,0 +1,104 @@
<?xml version="1.0" encoding="UTF-8"?>
<symfony>
<commands>
<command id="help" name="help">
<usage>help [--xml] [--format="..."] [--raw] [command_name]</usage>
<description>Displays help for a command</description>
<help>The &lt;info&gt;help&lt;/info&gt; command displays help for a given command:
&lt;info&gt;php app/console help list&lt;/info&gt;
You can also output the help in other formats by using the &lt;comment&gt;--format&lt;/comment&gt; option:
&lt;info&gt;php app/console help --format=xml list&lt;/info&gt;
To display the list of available commands, please use the &lt;info&gt;list&lt;/info&gt; command.</help>
<aliases/>
<arguments>
<argument name="command_name" is_required="0" is_array="0">
<description>The command name</description>
<defaults>
<default>help</default>
</defaults>
</argument>
</arguments>
<options>
<option name="--xml" shortcut="" accept_value="0" is_value_required="0" is_multiple="0">
<description>To output help as XML</description>
</option>
<option name="--format" shortcut="" accept_value="1" is_value_required="1" is_multiple="0">
<description>To output help in other formats</description>
<defaults/>
</option>
<option name="--raw" shortcut="" accept_value="0" is_value_required="0" is_multiple="0">
<description>To output raw command help</description>
</option>
<option name="--help" shortcut="-h" accept_value="0" is_value_required="0" is_multiple="0">
<description>Display this help message.</description>
</option>
<option name="--quiet" shortcut="-q" accept_value="0" is_value_required="0" is_multiple="0">
<description>Do not output any message.</description>
</option>
<option name="--verbose" shortcut="-v" shortcuts="-v|-vv|-vvv" accept_value="0" is_value_required="0" is_multiple="0">
<description>Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug</description>
</option>
<option name="--version" shortcut="-V" accept_value="0" is_value_required="0" is_multiple="0">
<description>Display this application version.</description>
</option>
<option name="--ansi" shortcut="" accept_value="0" is_value_required="0" is_multiple="0">
<description>Force ANSI output.</description>
</option>
<option name="--no-ansi" shortcut="" accept_value="0" is_value_required="0" is_multiple="0">
<description>Disable ANSI output.</description>
</option>
<option name="--no-interaction" shortcut="-n" accept_value="0" is_value_required="0" is_multiple="0">
<description>Do not ask any interactive question.</description>
</option>
</options>
</command>
<command id="list" name="list">
<usage>list [--xml] [--raw] [--format="..."] [namespace]</usage>
<description>Lists commands</description>
<help>The &lt;info&gt;list&lt;/info&gt; command lists all commands:
&lt;info&gt;php app/console list&lt;/info&gt;
You can also display the commands for a specific namespace:
&lt;info&gt;php app/console list test&lt;/info&gt;
You can also output the information in other formats by using the &lt;comment&gt;--format&lt;/comment&gt; option:
&lt;info&gt;php app/console list --format=xml&lt;/info&gt;
It's also possible to get raw list of commands (useful for embedding command runner):
&lt;info&gt;php app/console list --raw&lt;/info&gt;</help>
<aliases/>
<arguments>
<argument name="namespace" is_required="0" is_array="0">
<description>The namespace name</description>
<defaults/>
</argument>
</arguments>
<options>
<option name="--xml" shortcut="" accept_value="0" is_value_required="0" is_multiple="0">
<description>To output list as XML</description>
</option>
<option name="--raw" shortcut="" accept_value="0" is_value_required="0" is_multiple="0">
<description>To output raw command list</description>
</option>
<option name="--format" shortcut="" accept_value="1" is_value_required="1" is_multiple="0">
<description>To output list in other formats</description>
<defaults/>
</option>
</options>
</command>
</commands>
<namespaces>
<namespace id="_global">
<command>help</command>
<command>list</command>
</namespace>
</namespaces>
</symfony>

@ -0,0 +1,388 @@
My Symfony application
======================
* alias1
* alias2
* help
* list
**descriptor:**
* descriptor:command1
* descriptor:command2
help
----
* Description: Displays help for a command
* Usage: `help [--xml] [--format="..."] [--raw] [command_name]`
* Aliases: <none>
The <info>help</info> command displays help for a given command:
<info>php app/console help list</info>
You can also output the help in other formats by using the <comment>--format</comment> option:
<info>php app/console help --format=xml list</info>
To display the list of available commands, please use the <info>list</info> command.
### Arguments:
**command_name:**
* Name: command_name
* Is required: no
* Is array: no
* Description: The command name
* Default: `'help'`
### Options:
**xml:**
* Name: `--xml`
* Shortcut: <none>
* Accept value: no
* Is value required: no
* Is multiple: no
* Description: To output help as XML
* Default: `false`
**format:**
* Name: `--format`
* Shortcut: <none>
* Accept value: yes
* Is value required: yes
* Is multiple: no
* Description: To output help in other formats
* Default: `NULL`
**raw:**
* Name: `--raw`
* Shortcut: <none>
* Accept value: no
* Is value required: no
* Is multiple: no
* Description: To output raw command help
* Default: `false`
**help:**
* Name: `--help`
* Shortcut: `-h`
* Accept value: no
* Is value required: no
* Is multiple: no
* Description: Display this help message.
* Default: `false`
**quiet:**
* Name: `--quiet`
* Shortcut: `-q`
* Accept value: no
* Is value required: no
* Is multiple: no
* Description: Do not output any message.
* Default: `false`
**verbose:**
* Name: `--verbose`
* Shortcut: `-v|-vv|-vvv`
* Accept value: no
* Is value required: no
* Is multiple: no
* Description: Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug
* Default: `false`
**version:**
* Name: `--version`
* Shortcut: `-V`
* Accept value: no
* Is value required: no
* Is multiple: no
* Description: Display this application version.
* Default: `false`
**ansi:**
* Name: `--ansi`
* Shortcut: <none>
* Accept value: no
* Is value required: no
* Is multiple: no
* Description: Force ANSI output.
* Default: `false`
**no-ansi:**
* Name: `--no-ansi`
* Shortcut: <none>
* Accept value: no
* Is value required: no
* Is multiple: no
* Description: Disable ANSI output.
* Default: `false`
**no-interaction:**
* Name: `--no-interaction`
* Shortcut: `-n`
* Accept value: no
* Is value required: no
* Is multiple: no
* Description: Do not ask any interactive question.
* Default: `false`
list
----
* Description: Lists commands
* Usage: `list [--xml] [--raw] [--format="..."] [namespace]`
* Aliases: <none>
The <info>list</info> command lists all commands:
<info>php app/console list</info>
You can also display the commands for a specific namespace:
<info>php app/console list test</info>
You can also output the information in other formats by using the <comment>--format</comment> option:
<info>php app/console list --format=xml</info>
It's also possible to get raw list of commands (useful for embedding command runner):
<info>php app/console list --raw</info>
### Arguments:
**namespace:**
* Name: namespace
* Is required: no
* Is array: no
* Description: The namespace name
* Default: `NULL`
### Options:
**xml:**
* Name: `--xml`
* Shortcut: <none>
* Accept value: no
* Is value required: no
* Is multiple: no
* Description: To output list as XML
* Default: `false`
**raw:**
* Name: `--raw`
* Shortcut: <none>
* Accept value: no
* Is value required: no
* Is multiple: no
* Description: To output raw command list
* Default: `false`
**format:**
* Name: `--format`
* Shortcut: <none>
* Accept value: yes
* Is value required: yes
* Is multiple: no
* Description: To output list in other formats
* Default: `NULL`
descriptor:command1
-------------------
* Description: command 1 description
* Usage: `descriptor:command1`
* Aliases: `alias1`, `alias2`
command 1 help
### Options:
**help:**
* Name: `--help`
* Shortcut: `-h`
* Accept value: no
* Is value required: no
* Is multiple: no
* Description: Display this help message.
* Default: `false`
**quiet:**
* Name: `--quiet`
* Shortcut: `-q`
* Accept value: no
* Is value required: no
* Is multiple: no
* Description: Do not output any message.
* Default: `false`
**verbose:**
* Name: `--verbose`
* Shortcut: `-v|-vv|-vvv`
* Accept value: no
* Is value required: no
* Is multiple: no
* Description: Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug
* Default: `false`
**version:**
* Name: `--version`
* Shortcut: `-V`
* Accept value: no
* Is value required: no
* Is multiple: no
* Description: Display this application version.
* Default: `false`
**ansi:**
* Name: `--ansi`
* Shortcut: <none>
* Accept value: no
* Is value required: no
* Is multiple: no
* Description: Force ANSI output.
* Default: `false`
**no-ansi:**
* Name: `--no-ansi`
* Shortcut: <none>
* Accept value: no
* Is value required: no
* Is multiple: no
* Description: Disable ANSI output.
* Default: `false`
**no-interaction:**
* Name: `--no-interaction`
* Shortcut: `-n`
* Accept value: no
* Is value required: no
* Is multiple: no
* Description: Do not ask any interactive question.
* Default: `false`
descriptor:command2
-------------------
* Description: command 2 description
* Usage: `descriptor:command2 [-o|--option_name] argument_name`
* Aliases: <none>
command 2 help
### Arguments:
**argument_name:**
* Name: argument_name
* Is required: yes
* Is array: no
* Description: <none>
* Default: `NULL`
### Options:
**option_name:**
* Name: `--option_name`
* Shortcut: `-o`
* Accept value: no
* Is value required: no
* Is multiple: no
* Description: <none>
* Default: `false`
**help:**
* Name: `--help`
* Shortcut: `-h`
* Accept value: no
* Is value required: no
* Is multiple: no
* Description: Display this help message.
* Default: `false`
**quiet:**
* Name: `--quiet`
* Shortcut: `-q`
* Accept value: no
* Is value required: no
* Is multiple: no
* Description: Do not output any message.
* Default: `false`
**verbose:**
* Name: `--verbose`
* Shortcut: `-v|-vv|-vvv`
* Accept value: no
* Is value required: no
* Is multiple: no
* Description: Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug
* Default: `false`
**version:**
* Name: `--version`
* Shortcut: `-V`
* Accept value: no
* Is value required: no
* Is multiple: no
* Description: Display this application version.
* Default: `false`
**ansi:**
* Name: `--ansi`
* Shortcut: <none>
* Accept value: no
* Is value required: no
* Is multiple: no
* Description: Force ANSI output.
* Default: `false`
**no-ansi:**
* Name: `--no-ansi`
* Shortcut: <none>
* Accept value: no
* Is value required: no
* Is multiple: no
* Description: Disable ANSI output.
* Default: `false`
**no-interaction:**
* Name: `--no-interaction`
* Shortcut: `-n`
* Accept value: no
* Is value required: no
* Is multiple: no
* Description: Do not ask any interactive question.
* Default: `false`

@ -0,0 +1,22 @@
<info>My Symfony application</info> version <comment>v1.0</comment>
<comment>Usage:</comment>
[options] command [arguments]
<comment>Options:</comment>
<info>--help</info> <info>-h</info> Display this help message.
<info>--quiet</info> <info>-q</info> Do not output any message.
<info>--verbose</info> <info>-v|vv|vvv</info> Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug
<info>--version</info> <info>-V</info> Display this application version.
<info>--ansi</info> Force ANSI output.
<info>--no-ansi</info> Disable ANSI output.
<info>--no-interaction</info> <info>-n</info> Do not ask any interactive question.
<comment>Available commands:</comment>
<info>alias1 </info> command 1 description
<info>alias2 </info> command 1 description
<info>help </info> Displays help for a command
<info>list </info> Lists commands
<comment>descriptor</comment>
<info>descriptor:command1 </info> command 1 description
<info>descriptor:command2 </info> command 2 description

@ -0,0 +1,181 @@
<?xml version="1.0" encoding="UTF-8"?>
<symfony>
<commands>
<command id="help" name="help">
<usage>help [--xml] [--format="..."] [--raw] [command_name]</usage>
<description>Displays help for a command</description>
<help>The &lt;info&gt;help&lt;/info&gt; command displays help for a given command:
&lt;info&gt;php app/console help list&lt;/info&gt;
You can also output the help in other formats by using the &lt;comment&gt;--format&lt;/comment&gt; option:
&lt;info&gt;php app/console help --format=xml list&lt;/info&gt;
To display the list of available commands, please use the &lt;info&gt;list&lt;/info&gt; command.</help>
<aliases/>
<arguments>
<argument name="command_name" is_required="0" is_array="0">
<description>The command name</description>
<defaults>
<default>help</default>
</defaults>
</argument>
</arguments>
<options>
<option name="--xml" shortcut="" accept_value="0" is_value_required="0" is_multiple="0">
<description>To output help as XML</description>
</option>
<option name="--format" shortcut="" accept_value="1" is_value_required="1" is_multiple="0">
<description>To output help in other formats</description>
<defaults/>
</option>
<option name="--raw" shortcut="" accept_value="0" is_value_required="0" is_multiple="0">
<description>To output raw command help</description>
</option>
<option name="--help" shortcut="-h" accept_value="0" is_value_required="0" is_multiple="0">
<description>Display this help message.</description>
</option>
<option name="--quiet" shortcut="-q" accept_value="0" is_value_required="0" is_multiple="0">
<description>Do not output any message.</description>
</option>
<option name="--verbose" shortcut="-v" shortcuts="-v|-vv|-vvv" accept_value="0" is_value_required="0" is_multiple="0">
<description>Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug</description>
</option>
<option name="--version" shortcut="-V" accept_value="0" is_value_required="0" is_multiple="0">
<description>Display this application version.</description>
</option>
<option name="--ansi" shortcut="" accept_value="0" is_value_required="0" is_multiple="0">
<description>Force ANSI output.</description>
</option>
<option name="--no-ansi" shortcut="" accept_value="0" is_value_required="0" is_multiple="0">
<description>Disable ANSI output.</description>
</option>
<option name="--no-interaction" shortcut="-n" accept_value="0" is_value_required="0" is_multiple="0">
<description>Do not ask any interactive question.</description>
</option>
</options>
</command>
<command id="list" name="list">
<usage>list [--xml] [--raw] [--format="..."] [namespace]</usage>
<description>Lists commands</description>
<help>The &lt;info&gt;list&lt;/info&gt; command lists all commands:
&lt;info&gt;php app/console list&lt;/info&gt;
You can also display the commands for a specific namespace:
&lt;info&gt;php app/console list test&lt;/info&gt;
You can also output the information in other formats by using the &lt;comment&gt;--format&lt;/comment&gt; option:
&lt;info&gt;php app/console list --format=xml&lt;/info&gt;
It's also possible to get raw list of commands (useful for embedding command runner):
&lt;info&gt;php app/console list --raw&lt;/info&gt;</help>
<aliases/>
<arguments>
<argument name="namespace" is_required="0" is_array="0">
<description>The namespace name</description>
<defaults/>
</argument>
</arguments>
<options>
<option name="--xml" shortcut="" accept_value="0" is_value_required="0" is_multiple="0">
<description>To output list as XML</description>
</option>
<option name="--raw" shortcut="" accept_value="0" is_value_required="0" is_multiple="0">
<description>To output raw command list</description>
</option>
<option name="--format" shortcut="" accept_value="1" is_value_required="1" is_multiple="0">
<description>To output list in other formats</description>
<defaults/>
</option>
</options>
</command>
<command id="descriptor:command1" name="descriptor:command1">
<usage>descriptor:command1</usage>
<description>command 1 description</description>
<help>command 1 help</help>
<aliases>
<alias>alias1</alias>
<alias>alias2</alias>
</aliases>
<arguments/>
<options>
<option name="--help" shortcut="-h" accept_value="0" is_value_required="0" is_multiple="0">
<description>Display this help message.</description>
</option>
<option name="--quiet" shortcut="-q" accept_value="0" is_value_required="0" is_multiple="0">
<description>Do not output any message.</description>
</option>
<option name="--verbose" shortcut="-v" shortcuts="-v|-vv|-vvv" accept_value="0" is_value_required="0" is_multiple="0">
<description>Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug</description>
</option>
<option name="--version" shortcut="-V" accept_value="0" is_value_required="0" is_multiple="0">
<description>Display this application version.</description>
</option>
<option name="--ansi" shortcut="" accept_value="0" is_value_required="0" is_multiple="0">
<description>Force ANSI output.</description>
</option>
<option name="--no-ansi" shortcut="" accept_value="0" is_value_required="0" is_multiple="0">
<description>Disable ANSI output.</description>
</option>
<option name="--no-interaction" shortcut="-n" accept_value="0" is_value_required="0" is_multiple="0">
<description>Do not ask any interactive question.</description>
</option>
</options>
</command>
<command id="descriptor:command2" name="descriptor:command2">
<usage>descriptor:command2 [-o|--option_name] argument_name</usage>
<description>command 2 description</description>
<help>command 2 help</help>
<aliases/>
<arguments>
<argument name="argument_name" is_required="1" is_array="0">
<description></description>
<defaults/>
</argument>
</arguments>
<options>
<option name="--option_name" shortcut="-o" accept_value="0" is_value_required="0" is_multiple="0">
<description></description>
</option>
<option name="--help" shortcut="-h" accept_value="0" is_value_required="0" is_multiple="0">
<description>Display this help message.</description>
</option>
<option name="--quiet" shortcut="-q" accept_value="0" is_value_required="0" is_multiple="0">
<description>Do not output any message.</description>
</option>
<option name="--verbose" shortcut="-v" shortcuts="-v|-vv|-vvv" accept_value="0" is_value_required="0" is_multiple="0">
<description>Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug</description>
</option>
<option name="--version" shortcut="-V" accept_value="0" is_value_required="0" is_multiple="0">
<description>Display this application version.</description>
</option>
<option name="--ansi" shortcut="" accept_value="0" is_value_required="0" is_multiple="0">
<description>Force ANSI output.</description>
</option>
<option name="--no-ansi" shortcut="" accept_value="0" is_value_required="0" is_multiple="0">
<description>Disable ANSI output.</description>
</option>
<option name="--no-interaction" shortcut="-n" accept_value="0" is_value_required="0" is_multiple="0">
<description>Do not ask any interactive question.</description>
</option>
</options>
</command>
</commands>
<namespaces>
<namespace id="_global">
<command>alias1</command>
<command>alias2</command>
<command>help</command>
<command>list</command>
</namespace>
<namespace id="descriptor">
<command>descriptor:command1</command>
<command>descriptor:command2</command>
</namespace>
</namespaces>
</symfony>

@ -6,7 +6,7 @@
<comment>Options:</comment>
<info>--help</info> <info>-h</info> Display this help message.
<info>--quiet</info> <info>-q</info> Do not output any message.
<info>--verbose</info> <info>-v</info> Increase verbosity of messages.
<info>--verbose</info> <info>-v|vv|vvv</info> Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug
<info>--version</info> <info>-V</info> Display this application version.
<info>--ansi</info> Force ANSI output.
<info>--no-ansi</info> Disable ANSI output.

@ -6,7 +6,7 @@
<comment>Options:</comment>
<info>--help</info> <info>-h</info> Display this help message.
<info>--quiet</info> <info>-q</info> Do not output any message.
<info>--verbose</info> <info>-v</info> Increase verbosity of messages.
<info>--verbose</info> <info>-v|vv|vvv</info> Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug
<info>--version</info> <info>-V</info> Display this application version.
<info>--ansi</info> Force ANSI output.
<info>--no-ansi</info> Disable ANSI output.

@ -2,15 +2,15 @@
<symfony>
<commands>
<command id="help" name="help">
<usage>help [--xml] [command_name]</usage>
<usage>help [--xml] [--format="..."] [--raw] [command_name]</usage>
<description>Displays help for a command</description>
<help>The &lt;info&gt;help&lt;/info&gt; command displays help for a given command:
&lt;info&gt;php app/console help list&lt;/info&gt;
You can also output the help as XML by using the &lt;comment&gt;--xml&lt;/comment&gt; option:
You can also output the help in other formats by using the &lt;comment&gt;--format&lt;/comment&gt; option:
&lt;info&gt;php app/console help --xml list&lt;/info&gt;
&lt;info&gt;php app/console help --format=xml list&lt;/info&gt;
To display the list of available commands, please use the &lt;info&gt;list&lt;/info&gt; command.</help>
<aliases />
@ -26,14 +26,21 @@
<option name="--xml" shortcut="" accept_value="0" is_value_required="0" is_multiple="0">
<description>To output help as XML</description>
</option>
<option name="--format" shortcut="" accept_value="1" is_value_required="1" is_multiple="0">
<description>To output help in other formats</description>
<defaults/>
</option>
<option name="--raw" shortcut="" accept_value="0" is_value_required="0" is_multiple="0">
<description>To output raw command help</description>
</option>
<option name="--help" shortcut="-h" accept_value="0" is_value_required="0" is_multiple="0">
<description>Display this help message.</description>
</option>
<option name="--quiet" shortcut="-q" accept_value="0" is_value_required="0" is_multiple="0">
<description>Do not output any message.</description>
</option>
<option name="--verbose" shortcut="-v" accept_value="0" is_value_required="0" is_multiple="0">
<description>Increase verbosity of messages.</description>
<option name="--verbose" shortcut="-v" shortcuts="-v|-vv|-vvv" accept_value="0" is_value_required="0" is_multiple="0">
<description>Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug</description>
</option>
<option name="--version" shortcut="-V" accept_value="0" is_value_required="0" is_multiple="0">
<description>Display this application version.</description>
@ -50,7 +57,7 @@
</options>
</command>
<command id="list" name="list">
<usage>list [--xml] [--raw] [namespace]</usage>
<usage>list [--xml] [--raw] [--format="..."] [namespace]</usage>
<description>Lists commands</description>
<help>The &lt;info&gt;list&lt;/info&gt; command lists all commands:
@ -60,9 +67,9 @@
&lt;info&gt;php app/console list test&lt;/info&gt;
You can also output the information as XML by using the &lt;comment&gt;--xml&lt;/comment&gt; option:
You can also output the information in other formats by using the &lt;comment&gt;--format&lt;/comment&gt; option:
&lt;info&gt;php app/console list --xml&lt;/info&gt;
&lt;info&gt;php app/console list --format=xml&lt;/info&gt;
It's also possible to get raw list of commands (useful for embedding command runner):
@ -76,11 +83,15 @@
</arguments>
<options>
<option name="--xml" shortcut="" accept_value="0" is_value_required="0" is_multiple="0">
<description>To output help as XML</description>
<description>To output list as XML</description>
</option>
<option name="--raw" shortcut="" accept_value="0" is_value_required="0" is_multiple="0">
<description>To output raw command list</description>
</option>
<option name="--format" shortcut="" accept_value="1" is_value_required="1" is_multiple="0">
<description>To output list in other formats</description>
<defaults/>
</option>
</options>
</command>
<command id="foo:bar" name="foo:bar">
@ -98,8 +109,8 @@
<option name="--quiet" shortcut="-q" accept_value="0" is_value_required="0" is_multiple="0">
<description>Do not output any message.</description>
</option>
<option name="--verbose" shortcut="-v" accept_value="0" is_value_required="0" is_multiple="0">
<description>Increase verbosity of messages.</description>
<option name="--verbose" shortcut="-v" shortcuts="-v|-vv|-vvv" accept_value="0" is_value_required="0" is_multiple="0">
<description>Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug</description>
</option>
<option name="--version" shortcut="-V" accept_value="0" is_value_required="0" is_multiple="0">
<description>Display this application version.</description>
@ -118,6 +129,7 @@
</commands>
<namespaces>
<namespace id="_global">
<command>afoobar</command>
<command>help</command>
<command>list</command>
</namespace>

@ -16,8 +16,8 @@
<option name="--quiet" shortcut="-q" accept_value="0" is_value_required="0" is_multiple="0">
<description>Do not output any message.</description>
</option>
<option name="--verbose" shortcut="-v" accept_value="0" is_value_required="0" is_multiple="0">
<description>Increase verbosity of messages.</description>
<option name="--verbose" shortcut="-v" shortcuts="-v|-vv|-vvv" accept_value="0" is_value_required="0" is_multiple="0">
<description>Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug</description>
</option>
<option name="--version" shortcut="-V" accept_value="0" is_value_required="0" is_multiple="0">
<description>Display this application version.</description>

@ -6,7 +6,7 @@
<comment>Options:</comment>
<info>--help</info> <info>-h</info> Display this help message.
<info>--quiet</info> <info>-q</info> Do not output any message.
<info>--verbose</info> <info>-v</info> Increase verbosity of messages.
<info>--verbose</info> <info>-v|vv|vvv</info> Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug
<info>--version</info> <info>-V</info> Display this application version.
<info>--ansi</info> Force ANSI output.
<info>--no-ansi</info> Disable ANSI output.

@ -6,6 +6,6 @@
list [--xml] [--raw] [namespace]
list [--xml] [--raw] [--format="..."] [namespace]

@ -6,7 +6,7 @@ Usage:
Options:
--help -h Display this help message.
--quiet -q Do not output any message.
--verbose -v Increase verbosity of messages.
--verbose -v|vv|vvv Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug
--version -V Display this application version.
--ansi Force ANSI output.
--no-ansi Disable ANSI output.

@ -1,5 +1,5 @@
Usage:
help [--xml] [command_name]
help [--xml] [--format="..."] [--raw] [command_name]
Arguments:
command The command to execute
@ -7,9 +7,11 @@ Arguments:
Options:
--xml To output help as XML
--format To output help in other formats
--raw To output raw command help
--help (-h) Display this help message.
--quiet (-q) Do not output any message.
--verbose (-v) Increase verbosity of messages.
--verbose (-v|vv|vvv) Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug
--version (-V) Display this application version.
--ansi Force ANSI output.
--no-ansi Disable ANSI output.
@ -20,9 +22,9 @@ Help:
php app/console help list
You can also output the help as XML by using the --xml option:
You can also output the help in other formats by using the --format option:
php app/console help --xml list
php app/console help --format=xml list
To display the list of available commands, please use the list command.

@ -1,12 +1,13 @@
Usage:
list [--xml] [--raw] [namespace]
list [--xml] [--raw] [--format="..."] [namespace]
Arguments:
namespace The namespace name
Options:
--xml To output help as XML
--xml To output list as XML
--raw To output raw command list
--format To output list in other formats
Help:
The list command lists all commands:
@ -17,9 +18,9 @@ Help:
php app/console list test
You can also output the information as XML by using the --xml option:
You can also output the information in other formats by using the --format option:
php app/console list --xml
php app/console list --format=xml
It's also possible to get raw list of commands (useful for embedding command runner):

@ -0,0 +1 @@
{"name":"descriptor:command1","usage":"descriptor:command1","description":"command 1 description","help":"command 1 help","aliases":["alias1","alias2"],"definition":{"arguments":[],"options":[]}}

@ -0,0 +1,8 @@
descriptor:command1
-------------------
* Description: command 1 description
* Usage: `descriptor:command1`
* Aliases: `alias1`, `alias2`
command 1 help

@ -0,0 +1,7 @@
<comment>Usage:</comment>
descriptor:command1
<comment>Aliases:</comment> <info>alias1, alias2</info>
<comment>Help:</comment>
command 1 help

@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<command id="descriptor:command1" name="descriptor:command1">
<usage>descriptor:command1</usage>
<description>command 1 description</description>
<help>command 1 help</help>
<aliases>
<alias>alias1</alias>
<alias>alias2</alias>
</aliases>
<arguments/>
<options/>
</command>

@ -0,0 +1 @@
{"name":"descriptor:command2","usage":"descriptor:command2 [-o|--option_name] argument_name","description":"command 2 description","help":"command 2 help","aliases":[],"definition":{"arguments":{"argument_name":{"name":"argument_name","is_required":true,"is_array":false,"description":"","default":null}},"options":{"option_name":{"name":"--option_name","shortcut":"-o","accept_value":false,"is_value_required":false,"is_multiple":false,"description":"","default":false}}}}

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save