Skip to content

Commit

Permalink
Bump Laravel Prompts. Can now use textarea and reversible forms (#5979)
Browse files Browse the repository at this point in the history
  • Loading branch information
weitzman committed May 2, 2024
1 parent 85cc0df commit 72da139
Show file tree
Hide file tree
Showing 3 changed files with 56 additions and 48 deletions.
2 changes: 1 addition & 1 deletion composer.json
Expand Up @@ -45,7 +45,7 @@
"dflydev/dot-access-data": "^3.0.2",
"grasmash/yaml-cli": "^3.1",
"guzzlehttp/guzzle": "^7.0",
"laravel/prompts": "^0.1.15",
"laravel/prompts": "^0.1.21",
"league/container": "^4.2",
"psy/psysh": "~0.11",
"symfony/event-dispatcher": "^6 || ^7",
Expand Down
95 changes: 48 additions & 47 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 7 additions & 0 deletions src/Commands/ConfiguresPrompts.php
Expand Up @@ -15,6 +15,7 @@
use Laravel\Prompts\SearchPrompt;
use Laravel\Prompts\SelectPrompt;
use Laravel\Prompts\SuggestPrompt;
use Laravel\Prompts\TextareaPrompt;
use Laravel\Prompts\TextPrompt;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Style\SymfonyStyle;
Expand Down Expand Up @@ -45,6 +46,12 @@ protected function configurePrompts(InputInterface $input)
$prompt->validate
));

TextareaPrompt::fallbackUsing(fn(TextareaPrompt $prompt) => $this->promptUntilValid(
fn() => (new SymfonyStyle($this->input, $this->output))->ask($prompt->label, $prompt->default ?: null) ?? '', // multiline: true
$prompt->required,
$prompt->validate
));

PasswordPrompt::fallbackUsing(fn (PasswordPrompt $prompt) => $this->promptUntilValid(
fn() => (new SymfonyStyle($this->input, $this->output))->askHidden($prompt->label) ?? '',
$prompt->required,
Expand Down

0 comments on commit 72da139

Please sign in to comment.