File tree 1 file changed +20
-5
lines changed
1 file changed +20
-5
lines changed Original file line number Diff line number Diff line change @@ -267,17 +267,32 @@ async function init() {
267
267
} ,
268
268
{
269
269
type : ( ) =>
270
- ! fs . existsSync ( targetDir ) || isEmpty ( targetDir ) ? null : 'confirm ' ,
270
+ ! fs . existsSync ( targetDir ) || isEmpty ( targetDir ) ? null : 'select ' ,
271
271
name : 'overwrite' ,
272
272
message : ( ) =>
273
273
( targetDir === '.'
274
274
? 'Current directory'
275
275
: `Target directory "${ targetDir } "` ) +
276
- ` is not empty. Remove existing files and continue?` ,
276
+ ` is not empty. Please choose how to proceed:` ,
277
+ initial : 0 ,
278
+ choices : [
279
+ {
280
+ title : 'Remove existing files and continue' ,
281
+ value : 'yes' ,
282
+ } ,
283
+ {
284
+ title : 'Cancel operation' ,
285
+ value : 'no' ,
286
+ } ,
287
+ {
288
+ title : 'Ignore files and continue' ,
289
+ value : 'ignore' ,
290
+ } ,
291
+ ] ,
277
292
} ,
278
293
{
279
- type : ( _ , { overwrite } : { overwrite ?: boolean } ) => {
280
- if ( overwrite === false ) {
294
+ type : ( _ , { overwrite } : { overwrite ?: string } ) => {
295
+ if ( overwrite === 'no' ) {
281
296
throw new Error ( red ( '✖' ) + ' Operation cancelled' )
282
297
}
283
298
return null
@@ -342,7 +357,7 @@ async function init() {
342
357
343
358
const root = path . join ( cwd , targetDir )
344
359
345
- if ( overwrite ) {
360
+ if ( overwrite === 'yes' ) {
346
361
emptyDir ( root )
347
362
} else if ( ! fs . existsSync ( root ) ) {
348
363
fs . mkdirSync ( root , { recursive : true } )
You can’t perform that action at this time.
0 commit comments