Skip to content

Commit

Permalink
fix(@angular/cli): Show non-schematic options with help
Browse files Browse the repository at this point in the history
  • Loading branch information
Brocco committed Oct 31, 2017
1 parent 9864e8a commit f5e7af1
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 6 deletions.
5 changes: 3 additions & 2 deletions packages/@angular/cli/commands/generate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import { SchematicAvailableOptions } from '../tasks/schematic-get-options';
const Command = require('../ember-cli/lib/models/command');
const SilentError = require('silent-error');

const { cyan, grey, yellow } = chalk;
const { cyan, yellow } = chalk;
const separatorRegEx = /[\/\\]/g;


Expand Down Expand Up @@ -199,7 +199,8 @@ export default Command.extend({
});
return getHelpOutputTask.run({
schematicName,
collectionName
collectionName,
nonSchematicOptions: this.availableOptions.filter((o: any) => !o.hidden)
})
.then((output: string[]) => {
return [
Expand Down
4 changes: 1 addition & 3 deletions packages/@angular/cli/commands/new.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,11 @@ import * as path from 'path';
import chalk from 'chalk';

import { CliConfig } from '../models/config';
import { getCollection, getEngineHost } from '../utilities/schematics';
import { validateProjectName } from '../utilities/validate-project-name';
import { oneLine } from 'common-tags';
import { SchematicAvailableOptions } from '../tasks/schematic-get-options';
import { outputFile } from 'fs-extra';

const { cyan, yellow } = chalk;
const { cyan } = chalk;

const Command = require('../ember-cli/lib/models/command');
const SilentError = require('silent-error');
Expand Down
9 changes: 8 additions & 1 deletion packages/@angular/cli/tasks/schematic-get-help-output.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,13 @@ export interface SchematicAvailableOptions {
schematicDefault: any;
}

const hiddenOptions = [
'name',
'path',
'source-dir',
'app-root'
];

export default Task.extend({
run: function ({schematicName, collectionName, nonSchematicOptions}: SchematicGetHelpOptions):
Promise<string[]> {
Expand All @@ -34,7 +41,7 @@ export default Task.extend({
.then(([availableOptions, nonSchematicOptions]: [SchematicAvailableOptions[], any[]]) => {
const output: string[] = [];
[...(nonSchematicOptions || []), ...availableOptions]
.filter(opt => opt.name !== 'name')
.filter(opt => hiddenOptions.indexOf(opt.name) === -1)
.forEach(opt => {
let text = cyan(` --${opt.name}`);
if (opt.schematicType) {
Expand Down

0 comments on commit f5e7af1

Please sign in to comment.