Skip to content

Commit

Permalink
fix(@angular/cli): Add an error message when we call ng doc without…
Browse files Browse the repository at this point in the history
… keyword. Currently, we open a page with the keyword `undefined`.
  • Loading branch information
wKoza committed Feb 6, 2019
1 parent f8e873b commit 9bbbc1c
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions packages/angular/cli/commands/doc-impl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,17 @@ const opn = require('opn');

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

return opn(searchUrl, {
return opn(searchUrl, {
wait: false,
});
});
}
this.logger.error('You should specify a keyword, for instance, `ng doc ActivatedRoute`.');
return 0;
}
}

0 comments on commit 9bbbc1c

Please sign in to comment.