Skip to content

Commit 3b7736a

Browse files
committed
fixup! 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 3af398c commit 3b7736a

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

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

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

1515
export class DocCommand extends Command<DocCommandSchema> {
1616
public async run(options: DocCommandSchema & Arguments) {
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-
}
17+
if (!options.keyword) {
18+
this.logger.error('You should specify a keyword, for instance, `ng doc ActivatedRoute`.');
2219

23-
return opn(searchUrl, {
24-
wait: false,
25-
});
20+
return 0;
21+
}
22+
let searchUrl = `https://angular.io/api?query=${options.keyword}`;
23+
if (options.search) {
24+
searchUrl = `https://www.google.com/search?q=site%3Aangular.io+${options.keyword}`;
2625
}
27-
this.logger.error('You should specify a keyword, for instance, `ng doc ActivatedRoute`.');
2826

29-
return 0;
27+
return opn(searchUrl, {
28+
wait: false,
29+
});
3030
}
3131
}

0 commit comments

Comments
 (0)