updated streamline-setup v2

This commit is contained in:
2025-01-15 08:53:49 -08:00
committed by alec.turner
parent a2ce9248f0
commit 4b569f81b0
20228 changed files with 2932048 additions and 63204 deletions
@@ -14,7 +14,7 @@ class SuggestPrompt extends Prompt
/**
* The options for the suggest prompt.
*
* @var array<string>|Closure(string): array<string>
* @var array<string>|Closure(string): (array<string>|Collection<int, string>)
*/
public array|Closure $options;
@@ -28,7 +28,7 @@ class SuggestPrompt extends Prompt
/**
* Create a new SuggestPrompt instance.
*
* @param array<string>|Collection<int, string>|Closure(string): array<string> $options
* @param array<string>|Collection<int, string>|Closure(string): (array<string>|Collection<int, string>) $options
*/
public function __construct(
public string $label,
@@ -39,6 +39,7 @@ class SuggestPrompt extends Prompt
public bool|string $required = false,
public mixed $validate = null,
public string $hint = '',
public ?Closure $transform = null,
) {
$this->options = $options instanceof Collection ? $options->all() : $options;
@@ -91,7 +92,9 @@ class SuggestPrompt extends Prompt
}
if ($this->options instanceof Closure) {
return $this->matches = array_values(($this->options)($this->value()));
$matches = ($this->options)($this->value());
return $this->matches = array_values($matches instanceof Collection ? $matches->all() : $matches);
}
return $this->matches = array_values(array_filter($this->options, function ($option) {