File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -58,6 +58,7 @@ export class NewCommand extends SchematicCommand {
5858 dryRun : options . dryRun ,
5959 force : options . force ,
6060 interactive : options . interactive ,
61+ defaults : options . defaults ,
6162 } ) ;
6263 }
6364
@@ -72,6 +73,7 @@ export class NewCommand extends SchematicCommand {
7273 delete opts . verbose ;
7374 delete opts . collection ;
7475 delete opts . interactive ;
76+ delete opts . defaults ;
7577
7678 return opts ;
7779 }
Original file line number Diff line number Diff line change 3838 "type" : " boolean" ,
3939 "default" : " true" ,
4040 "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."
4146 }
4247 },
4348 "required" : []
Original file line number Diff line number Diff line change @@ -62,6 +62,7 @@ export interface RunSchematicOptions {
6262 force : boolean ;
6363 showNothingDone ?: boolean ;
6464 interactive ?: boolean ;
65+ defaults ?: boolean ;
6566}
6667
6768export interface GetOptionsOptions {
@@ -282,6 +283,11 @@ export abstract class SchematicCommand extends Command {
282283 } ) ;
283284
284285 if ( options . interactive !== false && process . stdout . isTTY ) {
286+ if ( options . defaults ) {
287+ ( workflow . registry as schema . CoreSchemaRegistry )
288+ . addPreTransform ( schema . transforms . addUndefinedDefaults ) ;
289+ }
290+
285291 workflow . registry . usePromptProvider ( ( definitions : Array < schema . PromptDefinition > ) => {
286292 const questions : inquirer . Questions = definitions . map ( definition => {
287293 const question : inquirer . Question = {
You can’t perform that action at this time.
0 commit comments