Skip to content

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

@moniuch

Description

@moniuch

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type
    No fields configured for issues without a type.

    Projects

    Status

    Needs triage

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions