Skip to content
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

Feature request: section support #115

Closed
henzeb opened this issue Feb 21, 2024 · 3 comments
Closed

Feature request: section support #115

henzeb opened this issue Feb 21, 2024 · 3 comments
Assignees

Comments

@henzeb
Copy link

henzeb commented Feb 21, 2024

I would love to see some support on sections.

Symfony has implementation for that, but was never really used in Laravel.

What it does is creating a segment in which you can add or delete lines while also having other segments which can be edited independently from each other.

One of the ideas is to be able to clear out prompts when entered information, but we can do so many things with sections. We could do live updating of sections using Laravel Reverb ;-)

An example of what could be done:

section('foo', function(){
     // anything in here happens within the section
     info('hello');
     // .... creating progressbars, requesting information.
})->clear();
info('we are done');

Another example:

info('asking questions:', section: 'foo');
$bar = section('bar');

$name = text('your name?', section: 'bar');
$bar->clear();
$password = password('your password?', section: $bar);
$bar->replace(
  function(){
     // replaces the entire content. Imagine it does more output.
     info('Thanks!');
  }
)

info('done asking questions.', section: 'foo');
@henzeb
Copy link
Author

henzeb commented Feb 24, 2024

After tinkering with Prompts a bit, I don't think sections are really needed for the watch method after all, They can be separated Feature Requests. I will PR the watch prompt somewhere this weekend.

@henzeb henzeb mentioned this issue Feb 25, 2024
@driesvints
Copy link
Member

Thanks! Let's see how your PR goes.

@henzeb
Copy link
Author

henzeb commented Feb 25, 2024

apparently it is not wanted. Made a package for it. https://packagist.org/packages/henzeb/prompts-extras

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

No branches or pull requests

3 participants