Merge pull request #6913 from mbrodala/scripts-description-toplevel
Move "scripts-description" to toplevelpull/6574/merge
commit
847ebed6e6
|
@ -278,16 +278,14 @@ JSON array of commands.
|
||||||
|
|
||||||
## Custom descriptions.
|
## Custom descriptions.
|
||||||
|
|
||||||
You can set custom script descriptions with the following extra in your composer.json:
|
You can set custom script descriptions with the following in your `composer.json`:
|
||||||
|
|
||||||
```json
|
```json
|
||||||
{
|
{
|
||||||
"extra": {
|
"scripts-descriptions": {
|
||||||
"scripts-description": {
|
|
||||||
"test": "Run all tests!"
|
"test": "Run all tests!"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
```
|
||||||
```
|
|
||||||
|
|
||||||
> **Note:** You can only set custom descriptions of custom commands.
|
> **Note:** You can only set custom descriptions of custom commands.
|
||||||
|
|
|
@ -379,7 +379,7 @@
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"type": ["object"],
|
"type": ["object"],
|
||||||
"description": "Scripts listeners that will be executed before/after some events.",
|
"description": "Script listeners that will be executed before/after some events.",
|
||||||
"properties": {
|
"properties": {
|
||||||
"pre-install-cmd": {
|
"pre-install-cmd": {
|
||||||
"type": ["array", "string"],
|
"type": ["array", "string"],
|
||||||
|
@ -447,6 +447,13 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"scripts-descriptions": {
|
||||||
|
"type": ["object"],
|
||||||
|
"description": "Descriptions for custom commands, shown in console help.",
|
||||||
|
"additionalProperties": {
|
||||||
|
"type": "string"
|
||||||
|
}
|
||||||
|
},
|
||||||
"support": {
|
"support": {
|
||||||
"type": "object",
|
"type": "object",
|
||||||
"properties": {
|
"properties": {
|
||||||
|
|
|
@ -228,7 +228,12 @@ class Application extends BaseApplication
|
||||||
if ($this->has($script)) {
|
if ($this->has($script)) {
|
||||||
$io->writeError('<warning>A script named '.$script.' would override a Composer command and has been skipped</warning>');
|
$io->writeError('<warning>A script named '.$script.' would override a Composer command and has been skipped</warning>');
|
||||||
} else {
|
} else {
|
||||||
$description = isset($composer['extra']['scripts-description'][$script]) ? $composer['extra']['scripts-description'][$script] : null;
|
$description = null;
|
||||||
|
|
||||||
|
if (isset($composer['scripts-descriptions'][$script])) {
|
||||||
|
$description = $composer['scripts-descriptions'][$script];
|
||||||
|
}
|
||||||
|
|
||||||
$this->add(new Command\ScriptAliasCommand($script, $description));
|
$this->add(new Command\ScriptAliasCommand($script, $description));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue