diff --git a/packages/framework/src/Console/Commands/UpdateConfigsCommand.php b/packages/framework/src/Console/Commands/UpdateConfigsCommand.php
index b26d40f1eca..365bb72235d 100644
--- a/packages/framework/src/Console/Commands/UpdateConfigsCommand.php
+++ b/packages/framework/src/Console/Commands/UpdateConfigsCommand.php
@@ -21,13 +21,19 @@ class UpdateConfigsCommand extends Command
/** @var string */
protected $description = 'Publish the default configuration files';
- /** @var bool */
- protected $hidden = true;
-
public function handle(): int
{
+ $options = [
+ 'All configs',
+ 'hyde-configs: Main configuration files',
+ 'support-configs: Laravel and package configuration files',
+ ];
+ $selection = $this->choice('Which configuration files do you want to publish?', $options, 'All configs');
+
+ $tag = $this->parseTagFromSelection($selection, $options);
+
Artisan::call('vendor:publish', [
- '--tag' => 'configs',
+ '--tag' => $tag,
'--force' => true,
], $this->output);
@@ -35,4 +41,11 @@ public function handle(): int
return Command::SUCCESS;
}
+
+ protected function parseTagFromSelection(string $selection, array $options): string
+ {
+ $tags = ['configs', 'hyde-configs', 'support-configs'];
+
+ return $tags[array_search($selection, $options)];
+ }
}
diff --git a/packages/framework/tests/Feature/Commands/UpdateConfigsCommandTest.php b/packages/framework/tests/Feature/Commands/UpdateConfigsCommandTest.php
index 4a228d1f437..cb02c76bf3c 100644
--- a/packages/framework/tests/Feature/Commands/UpdateConfigsCommandTest.php
+++ b/packages/framework/tests/Feature/Commands/UpdateConfigsCommandTest.php
@@ -33,6 +33,7 @@ public function tearDown(): void
public function test_command_has_expected_output()
{
$this->artisan('update:configs')
+ ->expectsChoice('Which configuration files do you want to publish?', 'All configs', $this->expectedOptions())
->expectsOutput(sprintf('Published config files to [%s]', Hyde::path('config')))
->assertExitCode(0);
}
@@ -41,7 +42,9 @@ public function test_config_files_are_published()
{
$this->assertDirectoryDoesNotExist(Hyde::path('config'));
- $this->artisan('update:configs')->assertExitCode(0);
+ $this->artisan('update:configs')
+ ->expectsChoice('Which configuration files do you want to publish?', 'All configs', $this->expectedOptions())
+ ->assertExitCode(0);
$this->assertFileEquals(Hyde::vendorPath('config/hyde.php'), Hyde::path('config/hyde.php'));
@@ -53,8 +56,19 @@ public function test_command_overwrites_existing_files()
File::makeDirectory(Hyde::path('config'));
File::put(Hyde::path('config/hyde.php'), 'foo');
- $this->artisan('update:configs')->assertExitCode(0);
+ $this->artisan('update:configs')
+ ->expectsChoice('Which configuration files do you want to publish?', 'All configs', $this->expectedOptions())
+ ->assertExitCode(0);
$this->assertNotEquals('foo', File::get(Hyde::path('config/hyde.php')));
}
+
+ protected function expectedOptions(): array
+ {
+ return [
+ 'All configs',
+ 'hyde-configs: Main configuration files',
+ 'support-configs: Laravel and package configuration files',
+ ];
+ }
}