co-vorpal is vorpal wrapper that enable using generator as command
$ npm install co-vorpal
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()
})
})
MIT