Skip to content

Commit

Permalink
Revert "Update InteractivePublishCommandHelper.php"
Browse files Browse the repository at this point in the history
This reverts commit 40633a7.
  • Loading branch information
caendesilva committed Dec 11, 2024
1 parent 40633a7 commit 18ae73c
Showing 1 changed file with 5 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,20 +25,18 @@ class InteractivePublishCommandHelper
protected readonly string $source;
protected readonly string $target;

protected readonly Collection $publishableFilesMap;

public function __construct(string $group)
{
$this->group = $group;
}

public function handle(): string
{
$this->publishableFilesMap = $this->mapPublishableFiles($this->findAllFilesForTag());
$publishableFilesMap = $this->mapPublishableFiles($this->findAllFilesForTag());

$choices = $this->getFileChoices();
$choices = $this->getFileChoices($publishableFilesMap);
$selectedFiles = multiselect('Select the files you want to publish (CTRL+A to toggle all)', $choices, [], 10, 'required', hint: 'Navigate with arrow keys, space to select, enter to confirm.');
$filesToPublish = $this->publishableFilesMap->filter(fn (string $file): bool => in_array($file, $selectedFiles));
$filesToPublish = $publishableFilesMap->filter(fn (string $file): bool => in_array($file, $selectedFiles));

$this->publishFiles($filesToPublish);

Expand Down Expand Up @@ -77,9 +75,9 @@ protected function getPublishedFilesForOutput(Collection $selectedFiles): string
return collect($selectedFiles)->map(fn (string $file): string => Str::after($file, basename($this->source).'/'))->implode(', ');
}

public function getFileChoices(): Collection
public function getFileChoices(Collection $publishableFilesMap): Collection
{
return $this->publishableFilesMap->mapWithKeys(/** @return array<string, string> */ function (string $source): array {
return $publishableFilesMap->mapWithKeys(/** @return array<string, string> */ function (string $source): array {
return [$source => Str::after($source, basename($this->target) . '/')];
});
}
Expand Down

0 comments on commit 18ae73c

Please sign in to comment.