sindresorhus / ora

Elegant terminal spinner
MIT License
9.08k stars 269 forks source link

Change text on succeed() #144

Closed sebastiantf closed 4 years ago

sebastiantf commented 4 years ago

Is there any way to change the text when we call .succeed() so that when the spinner succeeds and green tick mark is shown, the text is changed to a success message.

Right now, I'm using stopAndPersist() as below:

    const spinner = ora(`Doing something...`).start();

    // Do something async...
    await doSomething();

    spinner.stopAndPersist({
        symbol: colors.green("✔"),
        text: "Successfully backed up .git",
    });

Is this the only way to achieve what I want, or am I missing something?

If this is the only way, it would be nice to have this functionality (to change the text on success) built into succeed()

sindresorhus commented 4 years ago

.succeed() accepts a text argument.

sebastiantf commented 4 years ago

Yes I used that too but it didn't seem to change the text at the time I opened this issue. I think it must've been because I wasn't doing an async operation at that time.

It seems to work fine now.

Closing this then.