jnizet 6ca6a5e92b 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
2017-07-19 15:57:15 -04:00

39 lines
834 B
TypeScript

const Command = require('../ember-cli/lib/models/command');
import { DocTask } from '../tasks/doc';
export interface DocOptions {
search?: boolean;
}
const DocCommand = Command.extend({
name: 'doc',
description: 'Opens the official Angular API documentation for a given keyword.',
works: 'everywhere',
availableOptions: [
{
name: 'search',
aliases: ['s'],
type: Boolean,
default: false,
description: 'Search whole angular.io instead of just api.'
}
],
anonymousOptions: [
'<keyword>'
],
run: function(commandOptions: DocOptions, rawArgs: Array<string>) {
const keyword = rawArgs[0];
const docTask = new DocTask({
ui: this.ui,
project: this.project
});
return docTask.run(keyword, commandOptions.search);
}
});
export default DocCommand;