1.0.0 • Published 8 years ago

co-vorpal v1.0.0

Weekly downloads
2
License
MIT
Repository
github
Last release
8 years ago

co-vorpal

co-vorpal is vorpal wrapper that enable using generator as command

Installation

$ npm install co-vorpal

Usage

Wrap the vorpal client

var vorpal = require('vorpal')()
var coVorpal = require('co-vorpal')

coVorpal(vorpal)

Use co style generator as command action

vorpal
  .command('foo <bar>')
  .action(function* (args) {
    var res = yield asyncApi(args.bar)
    this.log(res)
  })

Still able to use normal function, won't affect existing code

vorpal
  .command('foo <bar>')
  .action(function (args, cb) {
    asyncApi(args.bar, (err, res) => {
      this.log(res)
      cb()
    })
  })

License

MIT