Skip to content

Commit

Permalink
Bypass vendor publish command search prompt
Browse files Browse the repository at this point in the history
Adds little value, but breaks some compatibility
  • Loading branch information
caendesilva committed Oct 19, 2023
1 parent b008504 commit ffcbe7a
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 0 deletions.
21 changes: 21 additions & 0 deletions packages/framework/src/Console/Commands/VendorPublishCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,17 @@ public function test_config_group_is_renamed_to_be_more_helpful()
])->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));
Expand Down

0 comments on commit ffcbe7a

Please sign in to comment.