sordina / Conscript

Restart a command on STDIN activity

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Conscript

Run a command and restart it on each new line of STDIN.

Conscript Command Restarter

Usage

conscript command [args*]

Examples

Use like 'watch':

while true; do echo lol ; sleep 1; done | conscript ls

Which is equivalent to the xargs command:

while true; do echo lol ; sleep 1; done | xargs -L 1 -I % ls

Where Conscript differs from xargs is that if the script is a long-running process, then subsequent incoming lines will kill that process and restart it, rather than wait for it to finish.

Useful in conjunction with Commando:

commando -c echo | grep --line-buffered Add  | conscript ls

Another example - Watch updates to a file:

commando | conscript bash -c "clear && less file.txt"

Binaries

About

Restart a command on STDIN activity

License:MIT License


Languages

Language:Haskell 96.1%Language:Shell 3.9%