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

result of format: val => ... should reflect in the logged value #423

Open
nicholaswmin opened this issue Oct 18, 2024 · 0 comments
Open

Comments

@nicholaswmin
Copy link

nicholaswmin commented Oct 18, 2024

Hello - great work guys.
loving it so far; easy, uncomplicated.

My philosophy is to keep as much leniency as possible in validate and try to "fix" user input in format.
The issue is that the result of format is hidden until the very end. The entered value doesn't update so the
user cant know what the values will look like until the prompt chain ends.

For example, this:

  • asks your name. Whatever you enter ,it changes it via format to "bar".
  • when you proceed to the next question asking about your age, I assume format has already run for the previous?
  • why not update the displayed answer then?

thoughts? is it possible?

  const response = await prompts([
    {
      type: 'text',
      name: 'value',
      message: 'name?',
      format: value => 'bar'
    },
    {
      type: 'number',
      name: 'age',
      message: 'age?',
      format: value => 100
    }
  ])

I've completed the 1st prompt, and I'm now filling the 2nd, the age. Yet it stil displays foo - it shouldn't since format always changes that value to bar. It should say 'bar' shouldn't it?

Can I manually "rerender" perhaps?

showing terminal output, im at 2nd prmompt filling my age
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

No branches or pull requests

1 participant