@@ -69,24 +69,7 @@ export async function main({
69
69
stderr = process . stderr ,
70
70
} : MainOptions ) : Promise < 0 | 1 > {
71
71
72
- /** Parse the command line. */
73
- const booleanArgs = [
74
- 'allowPrivate' ,
75
- 'debug' ,
76
- 'dry-run' ,
77
- 'force' ,
78
- 'help' ,
79
- 'list-schematics' ,
80
- 'verbose' ,
81
- ] ;
82
- const argv = minimist ( args , {
83
- boolean : booleanArgs ,
84
- default : {
85
- 'debug' : null ,
86
- 'dry-run' : null ,
87
- } ,
88
- '--' : true ,
89
- } ) ;
72
+ const argv = parseArgs ( args ) ;
90
73
91
74
/** Create the DevKit Logger used through the CLI. */
92
75
const logger = createConsoleLogger ( argv [ 'verbose' ] , stdout , stderr ) ;
@@ -128,7 +111,7 @@ export async function main({
128
111
const debug : boolean = argv . debug === null ? isLocalCollection : argv . debug ;
129
112
const dryRun : boolean = argv [ 'dry-run' ] === null ? debug : argv [ 'dry-run' ] ;
130
113
const force = argv [ 'force' ] ;
131
- const allowPrivate = argv [ 'allowPrivate ' ] ;
114
+ const allowPrivate = argv [ 'allow-private ' ] ;
132
115
133
116
/** Create a Virtual FS Host scoped to where the process is being run. **/
134
117
const fsHost = new virtualFs . ScopedHost ( new NodeJsSyncHost ( ) , normalize ( process . cwd ( ) ) ) ;
@@ -282,7 +265,7 @@ function getUsage(): string {
282
265
--debug Debug mode. This is true by default if the collection is a relative
283
266
path (in that case, turn off with --debug=false).
284
267
285
- --allowPrivate Allow private schematics to be run from the command line. Default to
268
+ --allow-private Allow private schematics to be run from the command line. Default to
286
269
false.
287
270
288
271
--dry-run Do not output anything, but instead just show what actions would be
@@ -301,6 +284,36 @@ function getUsage(): string {
301
284
` ;
302
285
}
303
286
287
+ /** Parse the command line. */
288
+ const booleanArgs = [
289
+ 'allowPrivate' ,
290
+ 'allow-private' ,
291
+ 'debug' ,
292
+ 'dry-run' ,
293
+ 'dryRun' ,
294
+ 'force' ,
295
+ 'help' ,
296
+ 'list-schematics' ,
297
+ 'listSchematics' ,
298
+ 'verbose' ,
299
+ ] ;
300
+
301
+ function parseArgs ( args : string [ ] | undefined ) : minimist . ParsedArgs {
302
+ return minimist ( args , {
303
+ boolean : booleanArgs ,
304
+ alias : {
305
+ 'dryRun' : 'dry-run' ,
306
+ 'listSchematics' : 'list-schematics' ,
307
+ 'allowPrivate' : 'allow-private' ,
308
+ } ,
309
+ default : {
310
+ 'debug' : null ,
311
+ 'dry-run' : null ,
312
+ } ,
313
+ '--' : true ,
314
+ } ) ;
315
+ }
316
+
304
317
if ( require . main === module ) {
305
318
const args = process . argv . slice ( 2 ) ;
306
319
main ( { args } )
0 commit comments