result of `format: val => ...` should reflect in the logged value
Author: nicholaswminCreated Oct 18, 2024Updated 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 viaformatto"bar". - when you proceed to the next question asking about your
age, I assumeformathas 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?
Source: terkelg/prompts