jbcarpanelli / spinnies

Node.js module to create and manage multiple spinners in command-line interface programs
MIT License
147 stars 32 forks source link

Add the ability to send a promise as an option to spinnies #3

Open jbcarpanelli opened 5 years ago

jbcarpanelli commented 5 years ago

Instead of setting a spinner as succeed/fail using the spinners#fail and spinner#succeed methods, it would be great if spinnies could do this automatically when sending a promise as an option:

spinnies.add('spinner-1', { 
  text: 'Doing X..',
  onPromise: {
    promise: someFunction(arg1, arg2), 
    succeed: { 
      text: 'X succeeded',
      color: 'greenBright'
    },
    fail: {
      ...
    } 
});