1
0
Fork 0

Move "scripts-description" to toplevel

Fixes #6881
pull/6913/head
Mathias Brodala 2017-12-18 10:14:24 +01:00
parent 0a9abeef88
commit 80d0c2029b
3 changed files with 21 additions and 11 deletions

View File

@ -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-description": {
"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.

View File

@ -447,6 +447,10 @@
} }
} }
}, },
"scripts-description": {
"type": ["object"],
"description": "Descriptions for scripts listeners, shown in console help."
},
"support": { "support": {
"type": "object", "type": "object",
"properties": { "properties": {

View File

@ -228,7 +228,15 @@ 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-description'][$script])) {
$description = $composer['scripts-description'][$script];
} elseif (isset($composer['extra']['scripts-description'][$script])) {
$io->writeError('<warning>You are using "scripts-description" in "extra" which is deprecated. Move "scripts-description" to the topmost level next to "scripts" instead.</warning>');
$description = $composer['extra']['scripts-description'][$script];
}
$this->add(new Command\ScriptAliasCommand($script, $description)); $this->add(new Command\ScriptAliasCommand($script, $description));
} }
} }