fix(@angular/cli): Add an error message when we call ng doc without keyword. Currently, we open a page with the keyword undefined. (#13604)

This commit is contained in:
William KOZA 2019-02-07 17:24:29 +01:00 committed by vikerman
parent be79d2a662
commit 416b05061f

View File

@ -14,6 +14,11 @@ const opn = require('opn');
export class DocCommand extends Command<DocCommandSchema> {
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}`;