Commit 5e39361 1 parent aa958a6 commit 5e39361 Copy full SHA for 5e39361
File tree 2 files changed +19
-4
lines changed
2 files changed +19
-4
lines changed Original file line number Diff line number Diff line change 1
1
const Command = require ( '../ember-cli/lib/models/command' ) ;
2
2
import { DocTask } from '../tasks/doc' ;
3
3
4
+ export interface DocOptions {
5
+ search ?: boolean ;
6
+ }
7
+
4
8
const DocCommand = Command . extend ( {
5
9
name : 'doc' ,
6
10
description : 'Opens the official Angular documentation for a given keyword.' ,
7
11
works : 'everywhere' ,
12
+ availableOptions : [
13
+ {
14
+ name : 'search' ,
15
+ aliases : [ 's' ] ,
16
+ type : Boolean ,
17
+ default : false ,
18
+ description : 'Search docs instead of api.'
19
+ }
20
+ ] ,
8
21
9
22
anonymousOptions : [
10
23
'<keyword>'
11
24
] ,
12
25
13
- run : function ( _commandOptions : any , rawArgs : Array < string > ) {
26
+ run : function ( commandOptions : DocOptions , rawArgs : Array < string > ) {
14
27
const keyword = rawArgs [ 0 ] ;
15
28
16
29
const docTask = new DocTask ( {
17
30
ui : this . ui ,
18
31
project : this . project
19
32
} ) ;
20
33
21
- return docTask . run ( keyword ) ;
34
+ return docTask . run ( keyword , commandOptions . search ) ;
22
35
}
23
36
} ) ;
24
37
Original file line number Diff line number Diff line change @@ -2,8 +2,10 @@ const Task = require('../ember-cli/lib/models/task');
2
2
const opn = require ( 'opn' ) ;
3
3
4
4
export const DocTask : any = Task . extend ( {
5
- run : function ( keyword : string ) {
6
- const searchUrl = `https://angular.io/docs/ts/latest/api/#!?query=${ keyword } ` ;
5
+ 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 } ` ;
8
+
7
9
return opn ( searchUrl , { wait : false } ) ;
8
10
}
9
11
} ) ;
You can’t perform that action at this time.
0 commit comments