https://github.com/gabrielcsapo/run-then
🚲 do something when, a text parser with purpose
https://github.com/gabrielcsapo/run-then
automation unix utility
Last synced: over 1 year ago
JSON representation
🚲 do something when, a text parser with purpose
- Host: GitHub
- URL: https://github.com/gabrielcsapo/run-then
- Owner: gabrielcsapo
- License: apache-2.0
- Created: 2018-08-27T20:57:08.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2018-09-05T06:47:42.000Z (almost 8 years ago)
- Last Synced: 2025-03-15T01:53:29.320Z (over 1 year ago)
- Topics: automation, unix, utility
- Language: JavaScript
- Homepage: https://gabrielcsapo.github.io/run-then
- Size: 9.77 KB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# run-then
> 🚲 do something when, a text parser with purpose
[](https://www.npmjs.com/package/run-then)
[](https://travis-ci.org/gabrielcsapo/run-then)
[](https://lcov-server.gabrielcsapo.com/coverage/github%2Ecom/gabrielcsapo/run-then)
[](https://starbuck.gabrielcsapo.com/github/gabrielcsapo/run-then)
[](https://starbuck.gabrielcsapo.com/github/gabrielcsapo/run-then#info=devDependencies)
[]()
[]()
## 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.
```js
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
```