diff --git a/src/Console/Commands/VendorPublishCommand.php b/src/Console/Commands/VendorPublishCommand.php
index f9a7c576..9ee4bd0b 100644
--- a/src/Console/Commands/VendorPublishCommand.php
+++ b/src/Console/Commands/VendorPublishCommand.php
@@ -13,6 +13,7 @@
use function realpath;
use function sprintf;
use function str_replace;
+use function Laravel\Prompts\select;
/**
* Publish any publishable assets from vendor packages.
@@ -42,6 +43,26 @@ public function handle(): void
ServiceProvider::$publishGroups = $originalGroups;
}
+ /**
+ * Our child method only uses the select function, instead of the search one.
+ */
+ protected function promptForProviderOrTag(): void
+ {
+ $choices = $this->publishableChoices();
+
+ $choice = select(
+ "Which provider or tag's files would you like to publish?",
+ $choices,
+ scroll: 15,
+ );
+
+ if ($choice == $choices[0]) {
+ return;
+ }
+
+ $this->parseChoice($choice);
+ }
+
/**
* Write a status message to the console.
*
diff --git a/tests/Feature/Commands/VendorPublishCommandTest.php b/tests/Feature/Commands/VendorPublishCommandTest.php
index 1c737443..a772c5fe 100644
--- a/tests/Feature/Commands/VendorPublishCommandTest.php
+++ b/tests/Feature/Commands/VendorPublishCommandTest.php
@@ -44,9 +44,9 @@ public function test_command_prompts_for_provider_or_tag()
$this->artisan('vendor:publish')
->expectsChoice('Which provider or tag\'s files would you like to publish?', 'Tag: example-configs', [
- 'Publish files from all providers and tags listed below',
'Provider:> ExampleProvider',
'Tag:> example-configs',
+ 'All providers and tags',
])
->assertExitCode(0);
}
@@ -60,7 +60,7 @@ public function test_unhelpful_publishers_are_removed()
$this->artisan('vendor:publish')
->expectsChoice('Which provider or tag\'s files would you like to publish?', 'Tag: example-configs', [
- 'Publish files from all providers and tags listed below',
+ 'All providers and tags',
])->assertExitCode(0);
}
@@ -73,11 +73,22 @@ public function test_config_group_is_renamed_to_be_more_helpful()
$this->artisan('vendor:publish')
->expectsChoice('Which provider or tag\'s files would you like to publish?', 'Tag: vendor-configs', [
- 'Publish files from all providers and tags listed below',
+ 'All providers and tags',
'Tag:> vendor-configs',
])->assertExitCode(0);
}
+ public function test_can_select_default()
+ {
+ ServiceProvider::$publishes = [];
+ ServiceProvider::$publishGroups = [];
+
+ $this->artisan('vendor:publish')
+ ->expectsChoice('Which provider or tag\'s files would you like to publish?', 'All providers and tags', [
+ 'All providers and tags',
+ ])->assertExitCode(0);
+ }
+
public function test_status_method()
{
$command = new StatusMethodTestClass($this->createMock(Filesystem::class));