bombshell-dev / clack

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

fix(@clack/prompts): add `spinner` hook to handle process exit #113

Closed Mist3rBru closed 1 year ago

Mist3rBru commented 1 year ago

Closes #106

It adds a hook to spinner, that prints a default message and avoid terminal conflicts, it triggers on:

changeset-bot[bot] commented 1 year ago

🦋 Changeset detected

Latest commit: 4a5a00fc4682ffcd4d8bc71103466a4d5faca67e

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package | Name | Type | | -------------- | ----- | | @clack/prompts | Patch |

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Mist3rBru commented 1 year ago

Code with try-catch logic, will still be able to call spinner.stop() and print their message

cpreston321 commented 1 year ago

Hey @Mist3rBru

While testing I did see this:

image

If you want to test yourself: cd examples/basic && pnpm start

The code looks good but it seems that maybe something messed up when merge. I just did a CRTL+C when installing deps was showing.

Thanks, CP 🚀