Warn when init is being used non-interactively without any args passed in, instead of silently overwriting the file

main
Jordi Boggiano 4 years ago
parent 53412a3299
commit 6a2f9870a7
No known key found for this signature in database
GPG Key ID: 7BBD42C429EC80BC

@ -129,6 +129,12 @@ EOT
return 1;
}
} else {
if (json_encode($options) === '{"require":{}}') {
throw new \RuntimeException('You have to run this command in interactive mode, or specify at least some data using --name, --require, etc.');
}
$io->writeError('Writing composer.json');
}
$file->write($options);

Loading…
Cancel
Save