这是indexloc提供的服务,不要输入任何密码
Skip to content

Conversation

@innocenzi
Copy link
Contributor

Proposed changes

This is the same as poppinss/cliui#1. Note that I'm PRing this via the GitHub interface, so I don't know if the linting will pass. I'll fix it if the CI yells at me.

Types of changes

  • Bugfix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)

Checklist

  • I have read the CONTRIBUTING doc
  • Lint and unit tests pass locally with my changes
  • I have added tests that prove my fix is effective or that my feature works.
  • I have added necessary documentation (if appropriate)

@innocenzi
Copy link
Contributor Author

Oh, question since I'm there: is it planned to change the prefix to match cliui's style? Or to bake the prompts directly in cliui?

@thetutlage
Copy link
Member

Thanks for the PR 😄

I believe, I will keep this module separate and not move it to cliui for now. No good reasons for it, but don't want to create more work for myself.

Regarding the prefix, can you point me to the exact code you are talking about?

@innocenzi
Copy link
Contributor Author

Hey, thank you for the answer.

Here's what I call the "prefix":

And here's what I thought it would look like:

To change it I just extended Prompt from @poppinss/prompts/build/src/Base to override the prompt method and hardcode the option.prefix property.
They are originally defined in each reimplemented method from Enquirer (eg. Prompt#ask).

@thetutlage
Copy link
Member

Okay. I am little bit confused. The prefix in cliui can have different values. Whereas with prompts we always want it to be a pointer so I think their design doesn't have to match. Lemme know if I am not getting it at all :)

@innocenzi
Copy link
Contributor Author

When I mention the cliui prefix, I mean the [ level ] one, not the one that we can modify on the fly (eg. not logger.info('text', 'custom prefix')).

What I was initially wondering (and I worked around it, as shown in the screenshots) is if the prompts' pointers (that I called prefix, see first screenshot) were going to match cliui's actual prefixes (eg. [ question ], see second screenshot).

And you answered my question:

Whereas with prompts we always want it to be a pointer so I think their design doesn't have to match.

So, thank you. I could work around it anyway. :)

@thetutlage
Copy link
Member

Cool. So we don't have anything more to change now. I will merge this PR. Thanks for taking out time for it 🙂

@thetutlage thetutlage merged commit ff464be into poppinss:develop Nov 12, 2020
@innocenzi innocenzi deleted the patch-1 branch November 12, 2020 11:56
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