From 316f1f238d1a5fc3cb9d1171594ca676130406c6 Mon Sep 17 00:00:00 2001 From: WilliamKoza Date: Wed, 6 Feb 2019 18:56:20 +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`. --- 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 6a0e7a265ecf..b20c8584cf0c 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}`;