Skip to content

[Request] Retrieve the partial user input on text prompt cancelation #407

@Gabriele-Tomberli

Description

@Gabriele-Tomberli

Is your feature request related to a problem? Please describe.
Currently, when using the @clack/prompts text prompt, all that is returned is either the user entered value (if submitted) or the cancel symbol (if canceled). When the request is canceled, there is no way to know what the user had typed up to that point.

Describe the solution you'd like
I would like to get a way to retrieve what the user had for input when it canceled the request. This is to implement a feature similar to the node CLI, where canceling with a non-empty value clears the input, while canceling with an empty value twice in a row triggers an exit.

Describe alternatives you've considered
For now I have to treat empty and non-empty values in the same way. I was considering re-implementing the text method, but feels a lot of work (the great TextPrompt customization would need to be duplicated) and I'm not even sure if the data would be available there to begin with.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    Status

    Needs triage

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions