From 7ca8747ae9704f16df354d1db0cb6423930acb44 Mon Sep 17 00:00:00 2001 From: Mike Brocchi Date: Tue, 13 Feb 2018 15:22:50 -0500 Subject: [PATCH] fix(@angular/cli): Fix help for generate command. fixes #9412 --- packages/@angular/cli/commands/generate.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/packages/@angular/cli/commands/generate.ts b/packages/@angular/cli/commands/generate.ts index 81e5d8995d46..1c53e54866d7 100644 --- a/packages/@angular/cli/commands/generate.ts +++ b/packages/@angular/cli/commands/generate.ts @@ -64,8 +64,11 @@ export default Command.extend({ ], getCollectionName(rawArgs: string[], parsedOptions?: { collection?: string }): [string, string] { + let collectionName: string = CliConfig.getValue('defaults.schematics.collection'); + if (!rawArgs || rawArgs.length === 0) { + return [collectionName, null]; + } let schematicName = rawArgs[0]; - let collectionName = CliConfig.getValue('defaults.schematics.collection'); if (schematicName.match(/:/)) { [collectionName, schematicName] = schematicName.split(':', 2); @@ -206,7 +209,7 @@ export default Command.extend({ printDetailedHelp: function (_options: any, rawArgs: any): string | Promise { const engineHost = getEngineHost(); - const collectionName = this.getCollectionName(); + const [collectionName] = this.getCollectionName(); const collection = getCollection(collectionName); const schematicName = rawArgs[1]; if (schematicName) {