This repository has been archived on 2023-08-20. You can view files and clone it, but cannot push or open issues or pull requests.
symfony/src/Symfony/Component/Console/Tests
Fabien Potencier 81bf9108a0 feature #13220 [Console] Made output docopt compatible (WouterJ)
This PR was squashed before being merged into the 2.7 branch (closes #13220).

Discussion
----------

[Console] Made output docopt compatible

| Q             | A
| ------------- | ---
| Bug fix?      | no
| New feature?  | yes
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | #6329
| License       | MIT
| Doc PR        | https://github.com/symfony/symfony-docs/issues/5016

This was harder than I thought. To sum up:

 * The output now follows the [docopt](http://docopt.org/) specification
 * There is a new `addUsage` method to add more usage patterns
 * The handling of spaces in the descriptors is refactored to make it easier to understand and to make it render better (using sprintf's features only made it worse imo)

Todo
---

 * [x] Add test for `addUsage` and friends
 * [x] Add test for multiline descriptions of arguments
 * <s>Convert long descriptions to multiline automatically</s>
 * [ ] Submit a doc PR for `addUsage`

Question
---

The docopt specification suggests we should add these usage patterns:

    %command.name% -h | --help
    %command.name% --version

I didn't do that yet, as I think it'll only makes the output more verbose and it's already pretty obvious.

I've taken some decisions which I don't think everybody agrees with. I'm willing to change it, so feel free to comment :)

/cc @Seldaek

Commits
-------

3910940 [Console] Made output docopt compatible
2015-04-08 07:37:48 +02:00
..
Command feature #13220 [Console] Made output docopt compatible (WouterJ) 2015-04-08 07:37:48 +02:00
Descriptor [Console] Made output docopt compatible 2015-04-08 07:37:46 +02:00
Fixtures feature #13220 [Console] Made output docopt compatible (WouterJ) 2015-04-08 07:37:48 +02:00
Formatter Merge branch '2.3' into 2.6 2015-03-22 17:55:57 +01:00
Helper [Console][Table] Add support for colspan/rowspan + multiple header lines 2015-03-26 17:59:57 +01:00
Input feature #13220 [Console] Made output docopt compatible (WouterJ) 2015-04-08 07:37:48 +02:00
Logger Merge branch '2.4' into 2.5 2014-09-22 11:14:18 +02:00
Output Merge branch '2.4' into 2.5 2014-07-08 14:21:33 +02:00
Tester [Console] added some tests for previous merge (refs #8626) 2013-09-30 21:59:36 +02:00
ApplicationTest.php Merge branch '2.3' into 2.6 2015-03-13 18:11:24 +01:00