Skip to content

Commit 6ca6a5e

Browse files
jnizetBrocco
authored andcommitted
fix(@angular/cli): fix doc command to work with new angular.io
- change the URL for the API search - use google search when --search option is true, since angular.io doesn't have a search page anymore - improve the help and doc of the doc command
1 parent 6015f07 commit 6ca6a5e

File tree

3 files changed

+17
-5
lines changed

3 files changed

+17
-5
lines changed

docs/documentation/doc.md

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,16 @@
33
# ng doc
44

55
## Overview
6-
`ng doc [search term]` Opens the official Angular documentation for a given keyword on [angular.io](https://angular.io).
6+
`ng doc [search term]` Opens the official Angular API documentation for a given keyword on [angular.io](https://angular.io).
7+
8+
## Options
9+
10+
<details>
11+
<summary>search</summary>
12+
<p>
13+
<code>--search</code> (alias: <code>-s</code>) <em>default value: false</em>
14+
</p>
15+
<p>
16+
Search for the keyword in the whole [angular.io](https://angular.io) documentation instead of just the API.
17+
</p>
18+
</details>

packages/@angular/cli/commands/doc.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,15 @@ export interface DocOptions {
77

88
const DocCommand = Command.extend({
99
name: 'doc',
10-
description: 'Opens the official Angular documentation for a given keyword.',
10+
description: 'Opens the official Angular API documentation for a given keyword.',
1111
works: 'everywhere',
1212
availableOptions: [
1313
{
1414
name: 'search',
1515
aliases: ['s'],
1616
type: Boolean,
1717
default: false,
18-
description: 'Search docs instead of api.'
18+
description: 'Search whole angular.io instead of just api.'
1919
}
2020
],
2121

packages/@angular/cli/tasks/doc.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ const opn = require('opn');
33

44
export const DocTask: any = Task.extend({
55
run: function(keyword: string, search: boolean) {
6-
const searchUrl = search ? `https://angular.io/search/#stq=${keyword}&stp=1` :
7-
`https://angular.io/docs/ts/latest/api/#!?query=${keyword}`;
6+
const searchUrl = search ? `https://www.google.com/search?q=site%3Aangular.io+${keyword}` :
7+
`https://angular.io/api?query=${keyword}`;
88

99
return opn(searchUrl, { wait: false });
1010
}

0 commit comments

Comments
 (0)