bombshell-dev / clack

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

[Request] Allow tab-to-complete for placeholders #114

Closed JoshuaKGoldberg closed 10 months ago

JoshuaKGoldberg commented 1 year ago

Is your feature request related to a problem? Please describe.

When getting a value from a prompt that includes a placeholder, it'd be nice if the user doesn't have to typoe it out explicitly. Other prompts allow pressing Tab to fill in the placeholder. Can we add this to Clack please?

import { text } from "@clack/prompts";

const value = await text({
    message: "input text please",
    placeholder: "default value do I have to type this out"
});

Describe the solution you'd like

When an input prompt is active and the placeholder exists and .startsWith the current typed text value (intentionally true for ""), pressing Tab should set the current typed text value to the placeholder.

Describe alternatives you've considered

🤷

Additional context

I'd love to send a PR! ❤️

JoshuaKGoldberg commented 10 months ago

ping @natemoo-re / @cpreston321 - is this something you have any interest in? I'd be happy to add it in myself, and even help maintain the library!

cpreston321 commented 10 months ago

@JoshuaKGoldberg I think we would appreciate to have another maintainer! Nate is the only one that has add access. If you would like please open a PR so @natemoo-re has visibility!

I think the goal is to get everything off the list for #35. Then starting adding new features after release.

Thanks, CP

JoshuaKGoldberg commented 10 months ago

Swell, thanks! I'll try to get to this Soon™️.