Skip to content

Commit

Permalink
Code
Browse files Browse the repository at this point in the history
  • Loading branch information
Kevnz committed May 17, 2019
1 parent 24acb0a commit 4033f77
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions bin/cli.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#!/usr/bin/env node

const program = require('commander')
const ora = require('ora')
const { delay } = require('@kev_nz/async-tools')

program
.version('1.0.0', '-v, --version')
.command('on <req>')
.description('Do something interesting from the command line')
.action(async (req) => {
const spinner = ora({ text: `Doing something on ${req}`, spinner: 'shark' }).start()
await delay(5000)

spinner.fail('There was a problem');
await delay(1000)
spinner.info('Trying to recover');
await delay(2000)
spinner.start()
await delay(5000)
spinner.succeed('Complete');
})

program.parse(process.argv)

0 comments on commit 4033f77

Please sign in to comment.