Skip to content

feat(doc): add "ng doc" command #361

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions addon/ng2/commands/doc.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import * as Command from 'ember-cli/lib/models/command';
import * as DocTask from '../tasks/doc';

const DocCommand = Command.extend({
name: 'doc',
description: 'Opens the official Angular documentation for a given keyword.',
works: 'everywhere',

anonymousOptions: [
'<keyword>'
],

run: function(commandOptions, rawArgs:Array<string>) {
var keyword = rawArgs[0];

var docTask = new DocTask({
ui: this.ui,
analytics: this.analytics,
project: this.project
});

return docTask.run(keyword);
}
});

module.exports = DocCommand;
3 changes: 2 additions & 1 deletion addon/ng2/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ module.exports = {
'lint': require('./commands/lint'),
'format': require('./commands/format'),
'version': require('./commands/version'),
'completion': require('./commands/completion')
'completion': require('./commands/completion'),
'doc': require('./commands/doc')
};
}
};
11 changes: 11 additions & 0 deletions addon/ng2/tasks/doc.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import * as Task from 'ember-cli/lib/models/task';
import * as opn from 'opn';

const DocTask = Task.extend({
run: function(keyword:string) {
var searchUrl = 'https://angular.io/docs/ts/latest/api/#!?apiFilter=' + keyword;
return opn(searchUrl);
}
});

module.exports = DocTask;
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
"leek": "0.0.21",
"lodash": "^4.6.1",
"multidep": "^2.0.0",
"opn": "4.0.1",
"resolve": "^1.1.7",
"shelljs": "^0.6.0",
"silent-error": "^1.0.0",
Expand Down