Attach origin of a 3rd party command

Summary:
Fixes #9236 as suggested.

<img width="505" alt="screen shot 2016-08-22 at 21 34 44" src="https://cloud.githubusercontent.com/assets/2464966/17868740/701a0ba0-68b0-11e6-87a5-4753d5bec688.png">

(just used dummy plugin that is actually deprecated to show the output)
Closes https://github.com/facebook/react-native/pull/9529

Differential Revision: D3784933

fbshipit-source-id: ee7d6a5b82a51b3dd9fa9e4cbca31bcf14761ae4
This commit is contained in:
Mike Grabowski
2016-08-29 08:30:52 -07:00
committed by Facebook Github Bot 2
parent 35e7a266db
commit ab8c00e896
3 changed files with 27 additions and 1 deletions

View File

@@ -52,11 +52,19 @@ function printHelpInformation() {
cmdName = cmdName + '|' + this._alias;
}
const sourceInformation = this.pkg
? [
` ${chalk.bold('Source:')} ${this.pkg.name}@${this.pkg.version}`,
'',
]
: [];
let output = [
'',
chalk.bold(chalk.cyan((` react-native ${cmdName} ${this.usage()}`))),
` ${this._description}`,
'',
...sourceInformation,
` ${chalk.bold('Options:')}`,
'',
this.optionHelp().replace(/^/gm, ' '),
@@ -114,6 +122,7 @@ const addCommand = (command: Command, config: Config) => {
cmd.helpInformation = printHelpInformation.bind(cmd);
cmd.examples = command.examples;
cmd.pkg = command.pkg;
options
.forEach(opt => cmd.option(