8000 Allow searching on `vendor:publish` prompt (#48586) · lozobojan/laravel-framework@157bdc5 · GitHub
[go: up one dir, main page]

Skip to content

Commit 157bdc5

Browse files
authored
Allow searching on vendor:publish prompt (laravel#48586)
1 parent 4b22e39 commit 157bdc5

File tree

1 file changed

+18
-5
lines changed

1 file changed

+18
-5
lines changed

src/Illuminate/Foundation/Console/VendorPublishCommand.php

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
use League\Flysystem\Visibility;
1616
use Symfony\Component\Console\Attribute\AsCommand;
1717

18+
use function Laravel\Prompts\search;
1819
use function Laravel\Prompts\select;
1920

2021
#[AsCommand(name: 'vendor:publish')]
@@ -114,11 +115,23 @@ protected function determineWhatShouldBePublished()
114115
*/
115116
protected function promptForProviderOrTag()
116117
{
117-
$choice = select(
118-
"Which provider or tag's files would you like to publish?",
119-
$choices = $this->publishableChoices(),
120-
scroll: 15,
121-
);
118+
$choices = $this->publishableChoices();
119+
120+
$choice = windows_os()
121+
? select(
122+
"Which provider or tag's files would you like to publish?",
123+
$choices,
124+
scroll: 15,
125+
)
126+
: search(
127+
label: "Which provider or tag's files would you like to publish?",
128+
placeholder: 'Search...',
129+
options: fn ($search) => array_filter(
130+
$choices,
131+
fn ($choice) => str_contains(strtolower($choice), strtolower($search))
132+
),
133+
scroll: 15,
134+
);
122135

123136
if ($choice == $choices[0] || is_null($choice)) {
124137
return;

0 commit comments

Comments
 (0)
0