clack icon indicating copy to clipboard operation
clack copied to clipboard

[Request] text: Add 'help' key to provide prompt description to the user

Open moniuch opened this issue 10 months ago • 1 comments

Could you suggest the best way to provide a legend/help text under the main prompt? Could be that it already exists, but I wasn't able to find it. I tried with a new line within message, which probably would work for small things:

name: () => text({message: 'What is your name?\nDon\'t lie!'}),

but is not really a good solution for a couple of reasons.

image

I tried the placeholder option, but it is definitely meant for editable inputs, and not for what I'm after

image

Would be best to have a hassle-free way of:

  • aligning the hint with the main prompt
  • wrapped text should also stay aligned with the main prompt
  • dimmed style by default

The placeholder key is half-way there, I'd say - first line nicely aligned, dimmed out text.

image

It could be under a new key in the options object (help):

name: () => text({
  message: 'What is your name?',
  help: 'Lorem ipsum dolor sit amet, consectetur adipisicing elit. Atque eaque error eum ex, fugiat harum labore laboriosam libero magnam maiores modi natus optio quae quod recusandae repellendus sapiente vero voluptatum.'
}),

Motivation: in extensive flows for which the package might be used, explaining the step and the consequences of user decision, is essential, so that's why it was my first thing I tested here.

moniuch avatar Aug 08 '23 18:08 moniuch