0.0.1 • Published 6 years ago

run-then v0.0.1

Weekly downloads
4
License
ISC
Repository
github
Last release
6 years ago

run-then

🚲 do something when, a text parser with purpose

Npm Version Build Status Coverage Status Dependency Status devDependency Status npm npm

What is this?

Have you ever had a process that takes a long time to finish? Ever want to be alerted or have something happen when that is done? Maybe a long grep or a process that takes awhile to build, but don't have control over the underlying tooling?

ls . | grep "foo" | run-then

This will check the rules at the following locations:

/{homedir}/.runrc
/{cwd}/.runrc

What do the configs look like?

An example can be found in /example with a README to show how to run it.

module.exports = {
  default: [{
    when: /^foo bar/,
    do: async function() {
      console.log('hi');
    }
  }],
  verbose: [{
    when: /(.+?)/,
    noOutput: true,
    do: async function(data) {
      console.log(`${Date()} ${data.trim()}`);
    }
  }],
  finished: [{
    onExit: true,
    do: async function(data) {
      console.log('done!');
    }
  }]
}

The default command will be executed when run like:

ls . | grep "foo" | run-then

Rules can be chained or run one at a time like such:

ls . | grep "foo" | run-then verbose finished