fix(@angular/cli): add more description

This commit is contained in:
Hans Larsen 2017-02-22 17:20:17 -08:00
parent 7ebe4f0d4e
commit b4594bac33
No known key found for this signature in database
GPG Key ID: 537DD9CDA3032687
10 changed files with 249 additions and 146 deletions

View File

@ -75,15 +75,18 @@ export const baseBuildCommandOptions: any = [
}, },
{ {
name: 'i18n-file', name: 'i18n-file',
type: String type: String,
description: 'Localization file to use for i18n.'
}, },
{ {
name: 'i18n-format', name: 'i18n-format',
type: String type: String,
description: 'Format of the localization file specified with --i18n-file.'
}, },
{ {
name: 'locale', name: 'locale',
type: String type: String,
description: 'Locale to use for i18n.'
}, },
{ {
name: 'extract-css', name: 'extract-css',

View File

@ -36,7 +36,7 @@ export interface CompletionCommandOptions {
all?: boolean; all?: boolean;
bash?: boolean; bash?: boolean;
zsh?: boolean; zsh?: boolean;
}; }
const commandsToIgnore = [ const commandsToIgnore = [
'destroy', 'destroy',
@ -51,9 +51,27 @@ const CompletionCommand = Command.extend({
description: 'Adds autocomplete functionality to `ng` commands and subcommands.', description: 'Adds autocomplete functionality to `ng` commands and subcommands.',
works: 'everywhere', works: 'everywhere',
availableOptions: [ availableOptions: [
{ name: 'all', type: Boolean, default: true, aliases: ['a'] }, {
{ name: 'bash', type: Boolean, default: false, aliases: ['b'] }, name: 'all',
{ name: 'zsh', type: Boolean, default: false, aliases: ['z'] } type: Boolean,
default: true,
aliases: ['a'],
description: 'Generate a completion script compatible with both bash and zsh.'
},
{
name: 'bash',
type: Boolean,
default: false,
aliases: ['b']
description: 'Generate a completion script for bash.'
},
{
name: 'zsh',
type: Boolean,
default: false,
aliases: ['z']
description: 'Generate a completion script for zsh.'
}
], ],
run: function (commandOptions: CompletionCommandOptions) { run: function (commandOptions: CompletionCommandOptions) {

View File

@ -21,22 +21,26 @@ const E2eCommand = Command.extend({
aliases: ['e'], aliases: ['e'],
description: 'Run e2e tests in existing project.', description: 'Run e2e tests in existing project.',
works: 'insideProject', works: 'insideProject',
availableOptions: overrideOptions( availableOptions: overrideOptions([
baseServeCommandOptions.concat([ ...baseServeCommandOptions,
{ {
name: 'config', name: 'config',
type: String, type: String,
aliases: ['c'], aliases: ['c'],
description: oneLine`Use a specific config file. description: oneLine`
Defaults to the protractor config file in angular-cli.json.` Use a specific config file.
Defaults to the protractor config file in angular-cli.json.
`
}, },
{ {
name: 'specs', name: 'specs',
type: Array, type: Array,
default: [], default: [],
aliases: ['sp'], aliases: ['sp'],
description: oneLine`Override specs in the protractor config. description: oneLine`
Can send in multiple specs by repeating flag (ng e2e --specs=spec1.ts --specs=spec2.ts).` Override specs in the protractor config.
Can send in multiple specs by repeating flag (ng e2e --specs=spec1.ts --specs=spec2.ts).
`
}, },
{ {
name: 'element-explorer', name: 'element-explorer',
@ -57,18 +61,23 @@ const E2eCommand = Command.extend({
type: Boolean, type: Boolean,
default: true, default: true,
aliases: ['s'], aliases: ['s'],
description: oneLine`Compile and Serve the app. description: oneLine`
All non-reload related serve options are also available (e.g. --port=4400).` Compile and Serve the app.
All non-reload related serve options are also available (e.g. --port=4400).
`
} }
]), [ ], [
{ name: 'port', default: 0 }, {
name: 'port',
default: 0,
description: 'The port to use to serve the application.'
},
{ {
name: 'watch', name: 'watch',
default: false, default: false,
description: 'Run build when files change.' description: 'Run build when files change.'
}, },
] ]),
),
run: function (commandOptions: E2eTaskOptions) { run: function (commandOptions: E2eTaskOptions) {
const E2eTask = require('../tasks/e2e').E2eTask; const E2eTask = require('../tasks/e2e').E2eTask;
this.project.ngConfig = this.project.ngConfig || CliConfig.fromProject(); this.project.ngConfig = this.project.ngConfig || CliConfig.fromProject();

View File

@ -6,7 +6,11 @@ const Command = require('../ember-cli/lib/models/command');
// defaults for BuildOptions // defaults for BuildOptions
export const baseEjectCommandOptions: any = [ export const baseEjectCommandOptions: any = [
...baseBuildCommandOptions, ...baseBuildCommandOptions,
{ name: 'force', 'type': Boolean }, {
name: 'force',
type: Boolean,
description: 'Overwrite any webpack.config.js and npm scripts already existing.'
},
{ {
name: 'app', name: 'app',
type: String, type: String,

View File

@ -15,7 +15,12 @@ const GetCommand = Command.extend({
works: 'everywhere', works: 'everywhere',
availableOptions: [ availableOptions: [
{ name: 'global', type: Boolean, 'default': false } {
name: 'global',
type: Boolean,
'default': false,
description: 'Get the value in the global configuration (in your home directory).'
}
], ],
run: function (commandOptions: GetOptions, rawArgs: string[]): Promise<void> { run: function (commandOptions: GetOptions, rawArgs: string[]): Promise<void> {

View File

@ -1,5 +1,8 @@
import {oneLine} from 'common-tags';
const Command = require('../ember-cli/lib/models/command'); const Command = require('../ember-cli/lib/models/command');
export interface LintCommandOptions { export interface LintCommandOptions {
fix?: boolean; fix?: boolean;
format?: string; format?: string;
@ -12,9 +15,27 @@ export default Command.extend({
description: 'Lints code in existing project.', description: 'Lints code in existing project.',
works: 'insideProject', works: 'insideProject',
availableOptions: [ availableOptions: [
{ name: 'fix', type: Boolean, default: false }, {
{ name: 'force', type: Boolean, default: false }, name: 'fix',
{ name: 'format', alias: 't', type: String, default: 'prose' } type: Boolean,
default: false,
description: 'Fixes linting errors (may overwrite linted files).'
},
{
name: 'force',
type: Boolean,
default: false,
description: 'Succeeds even if there was linting errors.'
},
{
name: 'format',
alias: 't',
type: String,
default: 'prose',
description: oneLine`
Output format (prose, json, stylish, verbose, pmd, msbuild, checkstyle, vso, fileslist).
`
}
], ],
run: function (commandOptions: LintCommandOptions) { run: function (commandOptions: LintCommandOptions) {
const LintTask = require('../tasks/lint').default; const LintTask = require('../tasks/lint').default;

View File

@ -71,7 +71,8 @@ const NewCommand = Command.extend({
name: 'skip-commit', name: 'skip-commit',
type: Boolean, type: Boolean,
default: false, default: false,
aliases: ['sc'] aliases: ['sc'],
description: 'Skip committing the first commit to git.'
}, },
{ {
name: 'directory', name: 'directory',

View File

@ -29,9 +29,15 @@ export interface ServeTaskOptions extends BuildOptions {
} }
// Expose options unrelated to live-reload to other commands that need to run serve // Expose options unrelated to live-reload to other commands that need to run serve
export const baseServeCommandOptions: any = overrideOptions( export const baseServeCommandOptions: any = overrideOptions([
baseBuildCommandOptions.concat([ ...baseBuildCommandOptions,
{ name: 'port', type: Number, default: defaultPort, aliases: ['p'] }, {
name: 'port',
type: Number,
default: defaultPort,
aliases: ['p'],
description: 'Port to listen to for serving.'
},
{ {
name: 'host', name: 'host',
type: String, type: String,
@ -39,10 +45,30 @@ export const baseServeCommandOptions: any = overrideOptions(
aliases: ['H'], aliases: ['H'],
description: `Listens only on ${defaultHost} by default.` description: `Listens only on ${defaultHost} by default.`
}, },
{ name: 'proxy-config', type: 'Path', aliases: ['pc'] }, {
{ name: 'ssl', type: Boolean, default: defaultSsl }, name: 'proxy-config',
{ name: 'ssl-key', type: String, default: defaultSslKey }, type: 'Path',
{ name: 'ssl-cert', type: String, default: defaultSslCert }, aliases: ['pc'],
description: 'Proxy configuration file.'
},
{
name: 'ssl',
type: Boolean,
default: defaultSsl,
description: 'Serve using HTTPS.'
},
{
name: 'ssl-key',
type: String,
default: defaultSslKey,
description: 'SSL key to use for serving HTTPS.'
},
{
name: 'ssl-cert',
type: String,
default: defaultSslCert,
description: 'SSL certificate to use for serving HTTPS.'
},
{ {
name: 'open', name: 'open',
type: Boolean, type: Boolean,
@ -50,7 +76,13 @@ export const baseServeCommandOptions: any = overrideOptions(
aliases: ['o'], aliases: ['o'],
description: 'Opens the url in default browser.', description: 'Opens the url in default browser.',
}, },
{ name: 'live-reload', type: Boolean, default: true, aliases: ['lr'] }, {
name: 'live-reload',
type: Boolean,
default: true,
aliases: ['lr'],
description: 'Whether to reload the page on change, using live-reload.'
},
{ {
name: 'live-reload-client', name: 'live-reload-client',
type: String, type: String,
@ -62,10 +94,13 @@ export const baseServeCommandOptions: any = overrideOptions(
default: false, default: false,
description: 'Enable hot module replacement.', description: 'Enable hot module replacement.',
} }
]), [ ], [
{ name: 'watch', default: true } {
] name: 'watch',
); default: true,
description: 'Rebuild on change.'
}
]);
const ServeCommand = Command.extend({ const ServeCommand = Command.extend({
name: 'serve', name: 'serve',

View File

@ -1,4 +1,4 @@
import {CliConfig} from '../models/config'; \import {CliConfig} from '../models/config';
const SilentError = require('silent-error'); const SilentError = require('silent-error');
const Command = require('../ember-cli/lib/models/command'); const Command = require('../ember-cli/lib/models/command');
@ -15,7 +15,13 @@ const SetCommand = Command.extend({
works: 'everywhere', works: 'everywhere',
availableOptions: [ availableOptions: [
{ name: 'global', type: Boolean, 'default': false, aliases: ['g'] }, {
name: 'global',
type: Boolean,
'default': false,
aliases: ['g'],
description: 'Set the value in the global configuration rather than in your project\'s.'
},
], ],
asBoolean: function (raw: string): boolean { asBoolean: function (raw: string): boolean {

View File

@ -15,7 +15,8 @@ const Xi18nCommand = Command.extend({
name: 'i18n-format', name: 'i18n-format',
type: String, type: String,
default: 'xlf', default: 'xlf',
aliases: ['f', {'xmb': 'xmb'}, {'xlf': 'xlf'}, {'xliff': 'xlf'}] aliases: ['f', {'xmb': 'xmb'}, {'xlf': 'xlf'}, {'xliff': 'xlf'}],
description: 'Output format for the generated file.'
}, },
{ {
name: 'output-path', name: 'output-path',