File tree 4 files changed +40
-1
lines changed
4 files changed +40
-1
lines changed Original file line number Diff line number Diff line change
1
+ import * as Command from 'ember-cli/lib/models/command' ;
2
+ import * as DocTask from '../tasks/doc' ;
3
+
4
+ const DocCommand = Command . extend ( {
5
+ name : 'doc' ,
6
+ description : 'Opens the official Angular documentation for a given keyword.' ,
7
+ works : 'everywhere' ,
8
+
9
+ anonymousOptions : [
10
+ '<keyword>'
11
+ ] ,
12
+
13
+ run : function ( commandOptions , rawArgs :Array < string > ) {
14
+ var keyword = rawArgs [ 0 ] ;
15
+
16
+ var docTask = new DocTask ( {
17
+ ui : this . ui ,
18
+ analytics : this . analytics ,
19
+ project : this . project
20
+ } ) ;
21
+
22
+ return docTask . run ( keyword ) ;
23
+ }
24
+ } ) ;
25
+
26
+ module . exports = DocCommand ;
Original file line number Diff line number Diff line change @@ -13,7 +13,8 @@ module.exports = {
13
13
'lint' : require ( './commands/lint' ) ,
14
14
'format' : require ( './commands/format' ) ,
15
15
'version' : require ( './commands/version' ) ,
16
- 'completion' : require ( './commands/completion' )
16
+ 'completion' : require ( './commands/completion' ) ,
17
+ 'doc' : require ( './commands/doc' )
17
18
} ;
18
19
}
19
20
} ;
Original file line number Diff line number Diff line change
1
+ import * as Task from 'ember-cli/lib/models/task' ;
2
+ import * as opn from 'opn' ;
3
+
4
+ const DocTask = Task . extend ( {
5
+ run : function ( keyword :string ) {
6
+ var searchUrl = 'https://angular.io/docs/ts/latest/api/#!?apiFilter=' + keyword ;
7
+ return opn ( searchUrl ) ;
8
+ }
9
+ } ) ;
10
+
11
+ module . exports = DocTask ;
Original file line number Diff line number Diff line change 43
43
"leek" : " 0.0.21" ,
44
44
"lodash" : " ^4.6.1" ,
45
45
"multidep" : " ^2.0.0" ,
46
+ "opn" : " 4.0.1" ,
46
47
"resolve" : " ^1.1.7" ,
47
48
"shelljs" : " ^0.6.0" ,
48
49
"silent-error" : " ^1.0.0" ,
You can’t perform that action at this time.
0 commit comments