Skip to content
🚲 do something when, a text parser with purpose
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
bin
example
test
.gitignore
.travis.yml
CHANGELOG.md
LICENSE
README.md
index.js
package.json

README.md

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
You can’t perform that action at this time.