From 416b05061f238ab1b60caa8f04de07eccb2ece2a Mon Sep 17 00:00:00 2001 From: William KOZA Date: Thu, 7 Feb 2019 17:24:29 +0100 Subject: [PATCH] fix(@angular/cli): Add an error message when we call `ng doc` without keyword. Currently, we open a page with the keyword `undefined`. (#13604) --- packages/angular/cli/commands/doc-impl.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/packages/angular/cli/commands/doc-impl.ts b/packages/angular/cli/commands/doc-impl.ts index 6a0e7a265e..b20c8584cf 100644 --- a/packages/angular/cli/commands/doc-impl.ts +++ b/packages/angular/cli/commands/doc-impl.ts @@ -14,6 +14,11 @@ const opn = require('opn'); export class DocCommand extends Command { public async run(options: DocCommandSchema & Arguments) { + if (!options.keyword) { + this.logger.error('You should specify a keyword, for instance, `ng doc ActivatedRoute`.'); + + return 0; + } let searchUrl = `https://angular.io/api?query=${options.keyword}`; if (options.search) { searchUrl = `https://www.google.com/search?q=site%3Aangular.io+${options.keyword}`;