deno-cliffy icon indicating copy to clipboard operation
deno-cliffy copied to clipboard

Prefill and edit prompt?

Open joehillen opened this issue 1 year ago • 1 comments

I'm not seeing a way to prefill a prompt with text that the user can edit. Is this something that cliffy supports?

joehillen avatar Feb 07 '24 19:02 joehillen

Currently you can only define a default value but it doesn't fill the input.

const name: string = await Input.prompt({
  message: "Whats your name?",
  default: "Foo",
});
? What's your name? (Foo) ›

One way to add support for this could be to fill the input with the default value when pressing tab. The easiest way to implement this could be to add the default value as first entry to the suggestions list.

c4spar avatar Feb 11 '24 13:02 c4spar