README
Cli Step Runner
A process tool that running the stdio tasks step by step for Node.js.
yarn add cli-step-runner
or
npm install cli-step-runner
Basic usage
const Runner = require('cli-step-runner')
const runner = new Runner()
runner.link({
info: 'hi, guys #1',
handler: (input, next) => {
console.log('..', input)
next()
}
})
runner.link([
{
info: 'hi, guys #2',
handler: input => {
console.log(input)
// doesn't do next
}
},
{
info: 'hi, guys #3',
handler: input => {
// Won't go this
}
}
])
runner.start() // run
Example 1
const runner = new Runner()
runner.show('hello my friend').handle(input => {
console.log('user input: ', input)
runner.stop() // Ending the stdio, only work on Windows
})
Example 2
const runner = new Runner()
runner
.show('hello my friend')
.show('do u love me ?')
.link(function(input, next) {
next({
args: [input, 'fuck me']
// set this option to send the params to next handler
})
})
.show('haha, what\'s your name ?')
.link(function(input, next, arg1, arg2) {
console.log(arg1, input, arg2)
console.log('----------------------')
next({
restart: true
// set this option to send the params to restart
})
})