Skip to content

Add default fallbacks #57

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed

Add default fallbacks #57

wants to merge 1 commit into from

Conversation

jessarcher
Copy link
Member

This PR adds default fallback behavior directly to the Prompts library so that it doesn't need to be implemented by consuming projects and packages.

This will allow us to remove this code from the Laravel installer.

We could also remove the same code from laravel/framework, however, the framework fallback currently uses the updated styling from Nuno.

@jessarcher jessarcher changed the title [0.x] Add default fallbacks Add default fallbacks Aug 25, 2023
protected function configureDefaultFallback(): void
{
self::fallbackUsing(fn (self $prompt) => $this->retryUntilValid(
fn () => (new SymfonyStyle(new ArrayInput([]), static::output()))->confirm($prompt->label, $prompt->default),
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We'd need to call the setInteractive method on the Input object to respect the --no-interaction option.

Implementing a first-party "non-interactive" feature in Prompts is probably worthwhile so we can return an appropriate value where possible and ensure that any required and validate arguments would pass regardless of the fallback configuration.

Symfony's choice component, for example, does not allow you to select no option but will return null in non-interactive mode.

@utsavsomaiya
Copy link

I don't know it is right or wrong for all?

image

image

But it's need the all has installed the tput

@jessarcher
Copy link
Member Author

Will revisit this later

@jessarcher jessarcher closed this Mar 6, 2024
@utsavsomaiya
Copy link

okay!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants