Skip to content

Commit fe10da2

Browse files
committed
Bypass vendor publish command search prompt
Adds little value, but breaks some compatibility
1 parent b008504 commit fe10da2

File tree

2 files changed

+32
-0
lines changed

2 files changed

+32
-0
lines changed

packages/framework/src/Console/Commands/VendorPublishCommand.php

+21
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
use function realpath;
1414
use function sprintf;
1515
use function str_replace;
16+
use function Laravel\Prompts\select;
1617

1718
/**
1819
* Publish any publishable assets from vendor packages.
@@ -42,6 +43,26 @@ public function handle(): void
4243
ServiceProvider::$publishGroups = $originalGroups;
4344
}
4445

46+
/**
47+
* Our child method only uses the select function, instead of the search one.
48+
*/
49+
protected function promptForProviderOrTag(): void
50+
{
51+
$choices = $this->publishableChoices();
52+
53+
$choice = select(
54+
"Which provider or tag's files would you like to publish?",
55+
$choices,
56+
scroll: 15,
57+
);
58+
59+
if ($choice == $choices[0]) {
60+
return;
61+
}
62+
63+
$this->parseChoice($choice);
64+
}
65+
4566
/**
4667
* Write a status message to the console.
4768
*

packages/framework/tests/Feature/Commands/VendorPublishCommandTest.php

+11
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,17 @@ public function test_config_group_is_renamed_to_be_more_helpful()
7878
])->assertExitCode(0);
7979
}
8080

81+
public function test_can_select_default()
82+
{
83+
ServiceProvider::$publishes = [];
84+
ServiceProvider::$publishGroups = [];
85+
86+
$this->artisan('vendor:publish')
87+
->expectsChoice('Which provider or tag\'s files would you like to publish?', 'All providers and tags', [
88+
'All providers and tags',
89+
])->assertExitCode(0);
90+
}
91+
8192
public function test_status_method()
8293
{
8394
$command = new StatusMethodTestClass($this->createMock(Filesystem::class));

0 commit comments

Comments
 (0)