Commit d193ad17 authored by Jodie Dunlop's avatar Jodie Dunlop

Add --force option to ignore existing directory in new command

parent a000defe
......@@ -25,7 +25,8 @@ class NewCommand extends Command
->setName('new')
->setDescription('Create a new Laravel application.')
->addArgument('name', InputArgument::OPTIONAL)
->addOption('dev', null, InputOption::VALUE_NONE, 'Installs the latest "development" release');
->addOption('dev', null, InputOption::VALUE_NONE, 'Installs the latest "development" release')
->addOption('force', null, InputOption::VALUE_NONE, 'Forces install even if the directory already exists');
}
/**
......@@ -41,9 +42,11 @@ class NewCommand extends Command
throw new RuntimeException('The Zip PHP extension is not installed. Please install it and try again.');
}
$this->verifyApplicationDoesntExist(
$directory = ($input->getArgument('name')) ? getcwd().'/'.$input->getArgument('name') : getcwd()
);
$directory = ($input->getArgument('name')) ? getcwd().'/'.$input->getArgument('name') : getcwd();
if (! $input->getOption('force')) {
$this->verifyApplicationDoesntExist($directory);
}
$output->writeln('<info>Crafting application...</info>');
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment