Skip to content

Commit 9bbbc1c

Browse files
committed
fix(@angular/cli): Add an error message when we call ng doc without keyword. Currently, we open a page with the keyword undefined.
1 parent f8e873b commit 9bbbc1c

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

packages/angular/cli/commands/doc-impl.ts

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,17 @@ const opn = require('opn');
1414

1515
export class DocCommand extends Command<DocCommandSchema> {
1616
public async run(options: DocCommandSchema & Arguments) {
17-
let searchUrl = `https://angular.io/api?query=${options.keyword}`;
18-
if (options.search) {
19-
searchUrl = `https://www.google.com/search?q=site%3Aangular.io+${options.keyword}`;
20-
}
17+
if(options.keyword) {
18+
let searchUrl = `https://angular.io/api?query=${options.keyword}`;
19+
if (options.search) {
20+
searchUrl = `https://www.google.com/search?q=site%3Aangular.io+${options.keyword}`;
21+
}
2122

22-
return opn(searchUrl, {
23+
return opn(searchUrl, {
2324
wait: false,
24-
});
25+
});
26+
}
27+
this.logger.error('You should specify a keyword, for instance, `ng doc ActivatedRoute`.');
28+
return 0;
2529
}
2630
}

0 commit comments

Comments
 (0)