-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathhelpers.php
29 lines (25 loc) · 1.27 KB
/
helpers.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
<?php
namespace ArtisanBuild\CommunityPrompts;
use Closure;
use Illuminate\Support\Collection;
/**
* Prompt the user to select an option from a scrollable tabbed list.
*
* @template TOption of array{id: int|string, tab: string, body: string}
*
* @param array<int, TOption>|Collection<int, TOption> $options
* @param int|Closure(Collection<int, TOption>): Collection<int, TOption> $default The default value for the prompt. If Closure, it is passed `$options` and should return a Collection containing only the desired record.
*/
function tabbedscrollableselect(string $label, array|Collection $options, int|Closure $default = 0, int $scroll = 14, int $max_width = 120, bool|string $required = true, mixed $validate = null, string $hint = '', ?Closure $transform = null): int|string|null
{
return (new TabbedScrollableSelectPrompt(...func_get_args()))->prompt();
}
/**
* Prompt the user for text input with auto-completion of filepath.
*
* @param array<string> $extensions
*/
function fileselector(string $label, string $placeholder = '', string $default = '', int $scroll = 5, bool|string $required = false, mixed $validate = null, string $hint = '', array $extensions = [], ?Closure $transform = null): string
{
return (new FileSelector(...func_get_args()))->prompt();
}