bombshell-dev / clack

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

Async validation #92

Open SeverinAlexB opened 1 year ago

SeverinAlexB commented 1 year ago

Is your feature request related to a problem? Please describe. I ask the user for an account id. I like to validate this id by checking it against the db which I can't do sync.

Describe the solution you'd like Make validate compatible with async.

Describe alternatives you've considered Currently I load all the accounts before the prompt so I can validate the id sync. This doesn't scale though.

Additional context That's it :)

ulken commented 1 year ago

Sounds reasonable. I'll have a looksy later.

ulken commented 1 year ago

Follow-up to keep you in the loop: I started looking into this, but quickly realized we need to provide feedback to the user while waiting.

Not entirely obvious how that would fit into the current implementation flow. Asked for input, but haven't gotten any, yet.

SeverinAlexB commented 1 year ago

Thx. I see your point. It is already worth having it without a spinner IMO. Most validation flows should be quick (db calls are in the ms). But I understand in case you want to have it perfect.

ulken commented 1 year ago

Progress has been made. Have some rough edges to smooth out.

jycouet commented 1 year ago

How/where could we enjoy this progress? :)