merged branch deguif/console_xml_list_improvement (PR #8928)
This PR was squashed before being merged into the master branch (closes #8928).
Discussion
----------
[Console] Improved xml generated when listing commands
| Q | A
| ------------- | ---
| Bug fix? | no
| New feature? | yes
| BC breaks? | yes
| Deprecations? | no
| Tests pass? | yes
| License | MIT
I marked this PR as a BC break, as it breaks the xml schema generated by the command __app/console list --xml__
It replaces the first node (currently _symfony_) by a more generic node name ( _application_ ) and adds the application name and application version if specified in the _Symfony\Component\Console\Application_ constructor.
Before (using composer console that uses symfony console component):
```
<?xml version="1.0" encoding="UTF-8"?>
<symfony>
...
</symfony>
```
After (using composer console that uses symfony console component):
```
<?xml version="1.0" encoding="UTF-8"?>
<application name="Composer" version="x.x.x">
...
</application>
```
Commits
-------
7958227
[Console] Improved xml generated when listing commands
This commit is contained in:
commit
703fda3b8b
@ -93,7 +93,15 @@ class XmlDescriptor extends Descriptor
|
|||||||
public function getApplicationDocument(Application $application, $namespace = null)
|
public function getApplicationDocument(Application $application, $namespace = null)
|
||||||
{
|
{
|
||||||
$dom = new \DOMDocument('1.0', 'UTF-8');
|
$dom = new \DOMDocument('1.0', 'UTF-8');
|
||||||
$dom->appendChild($rootXml = $dom->createElement('symfony'));
|
$dom->appendChild($rootXml = $dom->createElement('application'));
|
||||||
|
|
||||||
|
if ($application->getName() !== 'UNKNOWN') {
|
||||||
|
$rootXml->setAttribute('name', $application->getName());
|
||||||
|
if ($application->getVersion() !== 'UNKNOWN') {
|
||||||
|
$rootXml->setAttribute('version', $application->getVersion());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$rootXml->appendChild($commandsXML = $dom->createElement('commands'));
|
$rootXml->appendChild($commandsXML = $dom->createElement('commands'));
|
||||||
|
|
||||||
$description = new ApplicationDescription($application, $namespace);
|
$description = new ApplicationDescription($application, $namespace);
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<symfony>
|
<application>
|
||||||
<commands>
|
<commands>
|
||||||
<command id="help" name="help">
|
<command id="help" name="help">
|
||||||
<usage>help [--xml] [--format="..."] [--raw] [command_name]</usage>
|
<usage>help [--xml] [--format="..."] [--raw] [command_name]</usage>
|
||||||
@ -105,4 +105,4 @@
|
|||||||
<command>list</command>
|
<command>list</command>
|
||||||
</namespace>
|
</namespace>
|
||||||
</namespaces>
|
</namespaces>
|
||||||
</symfony>
|
</application>
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<symfony>
|
<application name="My Symfony application" version="v1.0">
|
||||||
<commands>
|
<commands>
|
||||||
<command id="help" name="help">
|
<command id="help" name="help">
|
||||||
<usage>help [--xml] [--format="..."] [--raw] [command_name]</usage>
|
<usage>help [--xml] [--format="..."] [--raw] [command_name]</usage>
|
||||||
@ -182,4 +182,4 @@
|
|||||||
<command>descriptor:command2</command>
|
<command>descriptor:command2</command>
|
||||||
</namespace>
|
</namespace>
|
||||||
</namespaces>
|
</namespaces>
|
||||||
</symfony>
|
</application>
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<symfony>
|
<application>
|
||||||
<commands>
|
<commands>
|
||||||
<command id="help" name="help">
|
<command id="help" name="help">
|
||||||
<usage>help [--xml] [--format="..."] [--raw] [command_name]</usage>
|
<usage>help [--xml] [--format="..."] [--raw] [command_name]</usage>
|
||||||
@ -141,4 +141,4 @@
|
|||||||
<command>foo:bar</command>
|
<command>foo:bar</command>
|
||||||
</namespace>
|
</namespace>
|
||||||
</namespaces>
|
</namespaces>
|
||||||
</symfony>
|
</application>
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<symfony>
|
<application>
|
||||||
<commands namespace="foo">
|
<commands namespace="foo">
|
||||||
<command id="foo:bar" name="foo:bar">
|
<command id="foo:bar" name="foo:bar">
|
||||||
<usage>foo:bar</usage>
|
<usage>foo:bar</usage>
|
||||||
@ -34,4 +34,4 @@
|
|||||||
</options>
|
</options>
|
||||||
</command>
|
</command>
|
||||||
</commands>
|
</commands>
|
||||||
</symfony>
|
</application>
|
||||||
|
Reference in New Issue
Block a user