bombshell-dev / clack

Effortlessly build beautiful command-line apps
https://clack.cc
5.53k stars 90 forks source link

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

Open moniuch opened 1 year ago

moniuch commented 1 year ago

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:

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.

cpreston321 commented 1 year ago

Issue relates to: #111