File tree Expand file tree Collapse file tree 1 file changed +4
-2
lines changed
packages/cli/src/commands Expand file tree Collapse file tree 1 file changed +4
-2
lines changed Original file line number Diff line number Diff line change @@ -21,22 +21,24 @@ export function setInitCommand(program: Command): void {
2121 . command ( 'init' )
2222 . argument ( '[output]' , 'Optional path used to output the configuration file' )
2323 . option ( '-d, --default' , 'Bypass prompts and select all defaults options' )
24+ . option ( '--force' , 'Overwrite existing configuration file, if any' )
2425 . option ( '--js' , 'Forces the output to be a JavaScript file' )
2526 . option ( '--gill' , 'Forces the output to be a gill based JavaScript file' )
2627 . action ( doInit ) ;
2728}
2829
2930type InitOptions = {
3031 default ?: boolean ;
31- js ?: boolean ;
32+ force ?: boolean ;
3233 gill ?: boolean ;
34+ js ?: boolean ;
3335} ;
3436
3537async function doInit ( explicitOutput : string | undefined , options : InitOptions ) {
3638 const output = getOutputPath ( explicitOutput , options ) ;
3739 const configFileType = getConfigFileType ( output , options ) ;
3840
39- if ( await canRead ( output ) ) {
41+ if ( ! options . force && ( await canRead ( output ) ) ) {
4042 throw new CliError ( `Configuration file already exists.` , [ `${ pico . bold ( 'Path' ) } : ${ output } ` ] ) ;
4143 }
4244
You can’t perform that action at this time.
0 commit comments