-
Notifications
You must be signed in to change notification settings - Fork 108
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
feat(@clack/prompts): multiline support #141
Conversation
🦋 Changeset detectedLatest commit: 62939c8 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Mist3rBru Straight killing it man 🙏🏼
Question:
- Shouldn't we support multiline at the core level vs trying make it work with
@clack/prompts
? The only reason I ask because to me I would think core will support the main functionality and prompt would extend that functionality.
I don't see how to implement it on |
Maybe we can add |
I think we will need to pass a custom formatter func within the As I think this could fix support temporary for |
Or we need to a way to expose what is the input text coming from core then do some special format around the input. I'm trying to think a neat way to handle it. |
@Mist3rBru I think for now you can keep this PR open and create a new draft pr that will mutate core functionality for a POW if you want. So we can get @natemoo-re to check it out. I'll do some more testing for the time being. |
@cpreston321 what if we create a method on |
Are you thinking of creating a new function within prompt called I am thinking of something that has a template then having a replacer for input styling. To keep things streamed line. (thinking out loud). Almost like template replacer with variables |
@cpreston321 now must be right. |
@cpreston321 I forgot the cancel prompt |
Hey @Mist3rBru it looks like the default state looks off too it should look like this: ┌ create-app
│
◇ Where should we create your project?
│ ./sparkling-solid
│ not ┌ create-app │
◆ Where should we create your project?
└ ./sparkling-solid |
@cpreston321 now must be right 🙏. |
@Mist3rBru I fixed the styles in this branch but if you want to copy them over then fix them here you can! |
Thanks @cpreston321, it is merged! Now what should I do? Keep with this branch, merge it with the #143, or look for another approach to implement this feature. |
@Mist3rBru #143, I think it's a step in the right direction. I also think it might need some fine tuning for it to be fully there. In my head I would think there would be a template and spot for input to support the multi line support for formatting in the terminal almost like a wrapper and within a input. I just an easy way to leave styling up to the user and we can focus on core functionality. Within prompts we create a lot of duplicate styles but really the only thing that is the variant of the I would think people would want to setup a custom wrapper for each prompt including state variants but also making the api very simple and easy to understand. Which I don't think is fully there. My thought (will fallback to base @clack/core __________________________________
|
| custom style template/wrapper
|
| |-----------------------------|
| | input (core formating) |
| |-----------------------------|
|
|
|__________________________________ I am just thinking out loud here but this is something I would imagine. I don't want the user to think about it too much. Making the api feel really easy, fluent, customizable is key. |
Also @Mist3rBru While playing around with multiline support I encounter this Screen.Recording.2023-08-15.at.1.20.31.PM.movHave any idea ? |
@cpreston321 It is almost fixed, there is an annoying |
@cpreston321 inner line break and cursor are fixed. I am going to close it, and focus on PR #143 |
That sounds good, I think that will a better direction for the library -- since it will be at the core. I will add my input over there. Hopefully Nate can get some input over there too! Thanks, |
Multiline Support
Support multiline texts either with
\n
, or long ones that exceed terminal width, without breaking the layoutList of supported prompts:
yes
/no
How to test
Closes #101
Closes #132
Relates #135 #111 #35