File tree 3 files changed +13
-0
lines changed
3 files changed +13
-0
lines changed Original file line number Diff line number Diff line change @@ -58,6 +58,7 @@ export class NewCommand extends SchematicCommand {
58
58
dryRun : options . dryRun ,
59
59
force : options . force ,
60
60
interactive : options . interactive ,
61
+ defaults : options . defaults ,
61
62
} ) ;
62
63
}
63
64
@@ -72,6 +73,7 @@ export class NewCommand extends SchematicCommand {
72
73
delete opts . verbose ;
73
74
delete opts . collection ;
74
75
delete opts . interactive ;
76
+ delete opts . defaults ;
75
77
76
78
return opts ;
77
79
}
Original file line number Diff line number Diff line change 38
38
"type" : " boolean" ,
39
39
"default" : " true" ,
40
40
"description" : " Disables interactive inputs (i.e., prompts)."
41
+ },
42
+ "defaults" : {
43
+ "type" : " boolean" ,
44
+ "default" : " false" ,
45
+ "description" : " Disables interactive inputs (i.e., prompts) for options with a default."
41
46
}
42
47
},
43
48
"required" : []
Original file line number Diff line number Diff line change @@ -62,6 +62,7 @@ export interface RunSchematicOptions {
62
62
force : boolean ;
63
63
showNothingDone ?: boolean ;
64
64
interactive ?: boolean ;
65
+ defaults ?: boolean ;
65
66
}
66
67
67
68
export interface GetOptionsOptions {
@@ -282,6 +283,11 @@ export abstract class SchematicCommand extends Command {
282
283
} ) ;
283
284
284
285
if ( options . interactive !== false && process . stdout . isTTY ) {
286
+ if ( options . defaults ) {
287
+ ( workflow . registry as schema . CoreSchemaRegistry )
288
+ . addPreTransform ( schema . transforms . addUndefinedDefaults ) ;
289
+ }
290
+
285
291
workflow . registry . usePromptProvider ( ( definitions : Array < schema . PromptDefinition > ) => {
286
292
const questions : inquirer . Questions = definitions . map ( definition => {
287
293
const question : inquirer . Question = {
You can’t perform that action at this time.
0 commit comments