File tree Expand file tree Collapse file tree 4 files changed +40
-1
lines changed
Expand file tree Collapse file tree 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 = {
1313 'lint' : require ( './commands/lint' ) ,
1414 'format' : require ( './commands/format' ) ,
1515 'version' : require ( './commands/version' ) ,
16- 'completion' : require ( './commands/completion' )
16+ 'completion' : require ( './commands/completion' ) ,
17+ 'doc' : require ( './commands/doc' )
1718 } ;
1819 }
1920} ;
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 4343 "leek" : " 0.0.21" ,
4444 "lodash" : " ^4.6.1" ,
4545 "multidep" : " ^2.0.0" ,
46+ "opn" : " 4.0.1" ,
4647 "resolve" : " ^1.1.7" ,
4748 "shelljs" : " ^0.6.0" ,
4849 "silent-error" : " ^1.0.0" ,
You can’t perform that action at this time.
0 commit comments