Skip to content

Commit ca78b49

Browse files
authored
Merge pull request #180 from humanmade/confirm-destroy
Add confirmation prompt before destroy
2 parents eeb58cd + 3672842 commit ca78b49

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

inc/composer/class-command.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
use Symfony\Component\Console\Input\InputArgument;
1515
use Symfony\Component\Console\Input\InputInterface;
1616
use Symfony\Component\Console\Output\OutputInterface;
17+
use Symfony\Component\Console\Question\ConfirmationQuestion;
1718
use Symfony\Component\Process\Process;
1819

1920
/**
@@ -270,6 +271,12 @@ protected function stop( InputInterface $input, OutputInterface $output ) {
270271
* @return int
271272
*/
272273
protected function destroy( InputInterface $input, OutputInterface $output ) {
274+
$helper = $this->getHelper( 'question' );
275+
$question = new ConfirmationQuestion( 'Are you sure you want to destroy the server?', false );
276+
if ( ! $helper->ask( $input, $output, $question ) ) {
277+
return false;
278+
}
279+
273280
$output->writeln( '<error>Destroying...</>' );
274281

275282
$proxy = new Process( 'docker-compose down -v', 'vendor/altis/local-server/docker', $this->get_env() );

0 commit comments

Comments
 (0)