Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions local-cli/cliEntry.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,13 @@ function printHelpInformation() {
cmdName = cmdName + '|' + this._alias;
}

const usage = this.usage();
const usageIsString = typeof(usage) === 'string';
const usageString = usageIsString ? usage : '[options]';
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's going to be an issue with this eventually. For example, how does one add an examples section to the link command? If you did add examples, you'd lose the original usage() value ([options] [packageName]).


let output = [
'',
chalk.bold(chalk.cyan((` react-native ${cmdName} [options]`))),
chalk.bold(chalk.cyan((` react-native ${cmdName} ${usageString}`))),
` ${this._description}`,
'',
` ${chalk.bold('Options:')}`,
Expand All @@ -62,9 +66,7 @@ function printHelpInformation() {
'',
];

const usage = this.usage();

if (usage !== '[options]') {
if (!usageIsString) {
const formattedUsage = usage.map(
example => ` ${example.desc}: \n ${chalk.cyan(example.cmd)}`,
).join('\n\n');
Expand Down