Skip to content

Commit

Permalink
confirm when creat in an existing folder
Browse files Browse the repository at this point in the history
  • Loading branch information
bangnokia committed Apr 5, 2024
1 parent fbcf542 commit 0182c5f
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 21 deletions.
11 changes: 7 additions & 4 deletions app/Commands/NewCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,21 @@ class NewCommand extends Command
{
protected $signature = 'new {name}';

protected $description = 'Create new site';
protected $description = 'Create new skeleton';

public function handle(Filesystem $filesystem): int
{
$directory = $this->argument('name');

if ($filesystem->isDirectory($directory)) {
$this->error($directory.' already existed');
if (
$filesystem->isDirectory($directory)
&& !$this->confirm("The directory $directory already exists. Do you want to continue?", false)
) {
$this->info('Aborted!');
return 1;
}

$filesystem->copyDirectory(base_path('skeleton'), $sitePath = getcwd().'/'.$directory);
$filesystem->copyDirectory(base_path('skeleton'), $sitePath = getcwd() . '/' . $directory);

$this->info("Your blog scaffolded successfully! 👏");

Expand Down
Binary file modified builds/lina
Binary file not shown.
2 changes: 1 addition & 1 deletion config/app.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
|
*/

'name' => 'Pekyll',
'name' => 'Lina',

/*
|--------------------------------------------------------------------------
Expand Down
16 changes: 0 additions & 16 deletions skeleton/composer.json

This file was deleted.

0 comments on commit 0182c5f

Please sign in to comment.