File tree Expand file tree Collapse file tree
packages/cli/src/commands Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -10,6 +10,7 @@ import { fileExists } from '../utils/fs.js';
1010import {
1111 selectPrompt ,
1212 multiselectPrompt ,
13+ confirmPrompt ,
1314 introPrompt ,
1415 outroPrompt ,
1516 spinnerTask ,
@@ -163,11 +164,17 @@ export async function runInit(options: InitOptions): Promise<void> {
163164
164165 if ( await fileExists ( dwfDir ) ) {
165166 const locationHint = scope === 'global'
166- ? '~/.dwf/ already exists in your home directory'
167- : '.dwf/ already exists in this directory' ;
168- ui . error ( locationHint , 'Remove it first or run from a different directory' ) ;
169- process . exitCode = 1 ;
170- return ;
167+ ? '~/.dwf/ already exists.'
168+ : '.dwf/ already exists in this directory.' ;
169+ ui . warn ( locationHint ) ;
170+ const overwrite = await confirmPrompt ( {
171+ message : 'Overwrite config? (rules will be preserved)' ,
172+ defaultValue : false ,
173+ } ) ;
174+ if ( ! overwrite ) {
175+ outroPrompt ( 'Init cancelled.' ) ;
176+ return ;
177+ }
171178 }
172179
173180 const projectName = scope === 'global' ? 'global' : basename ( cwd ) ;
You can’t perform that action at this time.
0 commit comments