Skip to content

Commit b06f840

Browse files
Broccohansl
authored andcommitted
fix(@angular/cli): Show non-schematic options with help
1 parent aff5257 commit b06f840

File tree

4 files changed

+12
-8
lines changed

4 files changed

+12
-8
lines changed

packages/@angular/cli/commands/generate.ts

+3-2
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ import { SchematicAvailableOptions } from '../tasks/schematic-get-options';
1717
const Command = require('../ember-cli/lib/models/command');
1818
const SilentError = require('silent-error');
1919

20-
const { cyan, grey, yellow } = chalk;
20+
const { cyan, yellow } = chalk;
2121
const separatorRegEx = /[\/\\]/g;
2222

2323

@@ -199,7 +199,8 @@ export default Command.extend({
199199
});
200200
return getHelpOutputTask.run({
201201
schematicName,
202-
collectionName
202+
collectionName,
203+
nonSchematicOptions: this.availableOptions.filter((o: any) => !o.hidden)
203204
})
204205
.then((output: string[]) => {
205206
return [

packages/@angular/cli/commands/help.ts

-2
Original file line numberDiff line numberDiff line change
@@ -67,9 +67,7 @@ const HelpCommand = Command.extend({
6767
if (commandOptions.short) {
6868
this.ui.writeLine(command.printShortHelp(commandOptions));
6969
} else if (command.printDetailedHelp(commandOptions, rawArgs)) {
70-
this.ui.writeLine('cool');
7170
const result = command.printDetailedHelp(commandOptions, rawArgs);
72-
this.ui.writeLine('not cool', result);
7371
if (result instanceof Promise) {
7472
result.then(r => this.ui.writeLine(r));
7573
} else {

packages/@angular/cli/commands/new.ts

+1-3
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,11 @@ import * as path from 'path';
33
import chalk from 'chalk';
44

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

12-
const { cyan, yellow } = chalk;
10+
const { cyan } = chalk;
1311

1412
const Command = require('../ember-cli/lib/models/command');
1513
const SilentError = require('silent-error');

packages/@angular/cli/tasks/schematic-get-help-output.ts

+8-1
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,13 @@ export interface SchematicAvailableOptions {
1818
schematicDefault: any;
1919
}
2020

21+
const hiddenOptions = [
22+
'name',
23+
'path',
24+
'source-dir',
25+
'app-root'
26+
];
27+
2128
export default Task.extend({
2229
run: function ({schematicName, collectionName, nonSchematicOptions}: SchematicGetHelpOptions):
2330
Promise<string[]> {
@@ -34,7 +41,7 @@ export default Task.extend({
3441
.then(([availableOptions, nonSchematicOptions]: [SchematicAvailableOptions[], any[]]) => {
3542
const output: string[] = [];
3643
[...(nonSchematicOptions || []), ...availableOptions]
37-
.filter(opt => opt.name !== 'name')
44+
.filter(opt => hiddenOptions.indexOf(opt.name) === -1)
3845
.forEach(opt => {
3946
let text = cyan(` --${opt.name}`);
4047
if (opt.schematicType) {

0 commit comments

Comments
 (0)