Skip to content

Commit 17a8239

Browse files
authored
Merge pull request #4 from jedymatt/Add---overwrite-env-flag
Add optional argument --overwrite with -O shortcut
2 parents dfbf54f + c5bef17 commit 17a8239

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/Console/SailEnvCommand.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@ class SailEnvCommand extends InstallCommand
1111
*
1212
* @var string
1313
*/
14-
protected $signature = 'sail:env';
14+
protected $signature = 'sail:env
15+
{--O|overwrite : Whether to overwrite the .env file if it exists}';
1516

1617
/**
1718
* The console command description.
@@ -44,6 +45,11 @@ class SailEnvCommand extends InstallCommand
4445
*/
4546
public function handle()
4647
{
48+
if ($this->option('overwrite-env')) {
49+
$this->comment('Overwriting environment variables');
50+
copy($this->laravel->basePath('.env.example'), $this->laravel->basePath('.env'));
51+
}
52+
4753
// Create .env file if it doesn't exist
4854
if (! file_exists($this->laravel->basePath('.env'))) {
4955
$this->warn('No .env file found. Creating .env file from .env.example');

0 commit comments

Comments
 (0)