0.0.1 • Published 7 years ago
run-then v0.0.1
run-then
🚲 do something when, a text parser with purpose
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-thenThis will check the rules at the following locations:
/{homedir}/.runrc
/{cwd}/.runrcWhat do the configs look like?
An example can be found in
/examplewith aREADMEto 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-thenRules can be chained or run one at a time like such:
ls . | grep "foo" | run-then verbose finished