Skip to content

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

Open
@nicholaswmin

Description

@nicholaswmin

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions