Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/3noch/twitch-cli
CLI to watch file patterns and run commands when they change
https://github.com/3noch/twitch-cli
cli command-line-tool file-system haskell inotify inotifywait
Last synced: 27 days ago
JSON representation
CLI to watch file patterns and run commands when they change
- Host: GitHub
- URL: https://github.com/3noch/twitch-cli
- Owner: 3noch
- License: bsd-3-clause
- Created: 2017-07-02T01:33:31.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2018-02-18T06:36:45.000Z (over 6 years ago)
- Last Synced: 2024-08-03T15:06:40.703Z (3 months ago)
- Topics: cli, command-line-tool, file-system, haskell, inotify, inotifywait
- Language: Haskell
- Size: 25.4 KB
- Stars: 8
- Watchers: 5
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# Twitch CLI
[![License](https://img.shields.io/badge/License-BSD%203--Clause-blue.svg)](https://opensource.org/licenses/BSD-3-Clause)
A simple command-line tool to watch one or more [Glob patterns](https://hackage.haskell.org/package/Glob/docs/System-FilePath-Glob.html#v:compile) and run commands when they change. Essentially this is a more ergonomic version of [`inotifywait`](https://linux.die.net/man/1/inotifywait).
The CLI UI of this tool is inspired by the [twitch](https://github.com/jfischoff/twitch) library, hence the name.
For a more advanced tool with similar features, checkout [steeloverseer](https://github.com/schell/steeloverseer). steeloverseer allows for more complex rules at the cost of a slightly less friendly interface.
## Usage
```bash
twitch --help# Watches for .pyc files at any depth and deletes
# them when created or modified.
twitch --debounce 0 -p '**/*.pyc:rm $FILE'# Watches .cabal files and reconfigures when they change.
# Also watches .hs files at any depth in the src folder
# and rebuilds the project when they change.
twitch -p '*.cabal:cabal configure && cabal build' -p 'src/**/*.hs:cabal build'# Watches all .log files in /var/log and prints their last line
# when they change.
twitch --debounce 0 -p '/var/log/*.log:tail -n 1 $FILE'
```## Development
Build with one of:
* `stack build`
* `nix-shell --run 'cabal build'`
* `nix-build`Develop with one of:
* `stack ghci`
* `nix-shell --run 'cabal repl'`