Skip to content

Commit 7976ba1

Browse files
committed
Add check before overriding deploy.php on init
1 parent d75e792 commit 7976ba1

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

src/Command/InitCommand.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,15 @@ protected function execute(InputInterface $input, OutputInterface $output): int
5757
$recipePath = "deploy.$language";
5858
}
5959

60+
// Avoid accidentally override of existing file.
61+
if (file_exists($recipePath)) {
62+
$io->warning("$recipePath already exists");
63+
if (!$io->confirm("Do you want to override the existing file?", false)) {
64+
$io->block('👍🏻');
65+
exit(1);
66+
}
67+
}
68+
6069
// Template
6170
$template = $io->choice('Select project template', $this->recipes(), 'common');
6271

0 commit comments

Comments
 (0)