Skip to content

Commit

Permalink
Cleanup and move up output
Browse files Browse the repository at this point in the history
  • Loading branch information
caendesilva committed Dec 10, 2024
1 parent dbef9bd commit 55f7eb3
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions packages/framework/src/Console/Commands/PublishViewsCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -135,18 +135,16 @@ protected function handleInteractivePublish(): void

// Now we need to prompt the user for which files to publish
$selectedFiles = $this->promptForFiles($files, basename($target));

$this->infoComment(sprintf("Selected files [%s]\n", collect($selectedFiles)->map(fn(string $file): string => Str::after($file, basename($source) . '/'))->implode(', ')));
}

protected function promptForFiles(Collection $files, string $baseDir): array
{
$choices = $files->mapWithKeys(/** @return array<string, string> */ function (string $source, string $target) use ($baseDir, $files): array {
$choices = $files->mapWithKeys(/** @return array<string, string> */ function (string $source) use ($baseDir, $files): array {
return [$source => Str::after($source, $baseDir.'/')];
});

$selected = multiselect('Select the files you want to publish', $choices, [], 10, 'required', hint: 'Navigate with arrow keys, space to select, enter to confirm.');

$this->infoComment(sprintf("Selected files [%s]\n", implode(', ', $selected)));

return $selected;
return multiselect('Select the files you want to publish', $choices, [], 10, 'required', hint: 'Navigate with arrow keys, space to select, enter to confirm.');
}
}

0 comments on commit 55f7eb3

Please sign in to comment.