Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/mharrisb1/ssfw
🪬 Super simple file watcher
https://github.com/mharrisb1/ssfw
filewatcher rust-lang simple
Last synced: 19 days ago
JSON representation
🪬 Super simple file watcher
- Host: GitHub
- URL: https://github.com/mharrisb1/ssfw
- Owner: mharrisb1
- Created: 2024-02-13T20:28:07.000Z (almost 1 year ago)
- Default Branch: main
- Last Pushed: 2024-06-26T01:00:18.000Z (8 months ago)
- Last Synced: 2024-06-26T02:24:43.489Z (8 months ago)
- Topics: filewatcher, rust-lang, simple
- Language: Rust
- Homepage:
- Size: 33.2 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
Awesome Lists containing this project
README
# 🪬 ssfw - Super simple file watcher
A minimal file watcher that executes a command in the foreground on file event.
## Usage
```bash
ssfw --pattern '*.rs' --command 'cargo test'
```> [!IMPORTANT]
> Please note the use of single quotes around the glob. This is required.## Help
```bash
🪬 Super simple file watcherUsage: ssfw [OPTIONS] --pattern
Options:
-p, --pattern Filter pattern
-c, --command Run command [default: :]
-w, --working-dir Optional working directory [default: .]
--sh Shell to execute command in [default: zsh] [possible values: zsh, bash]
--debounce Optional debounce window (ms) [default: 500]
--force-poll Force poll watcher
--poll Polling interval (ms). Ignored unless force poll is used [default: 500]
-v, --verbose... Increase logging verbosity
-q, --quiet... Decrease logging verbosity
-h, --help Print help
-V, --version Print version
```## Patterns
Any valid [glob](https://docs.rs/globset/latest/globset/#syntax) pattern can be used for filtering events. If a file event is detected that matches the given patter, then the command will be ran.
## Variables
> [!WARNING]
> Variables are unstable and subject to changeVariables allow you to pass values from the event context to the command.
For example:
```bash
ssfw --pattern '*.ts' --command 'eslint --fix {path}'
```This would run `eslint --fix` _just_ for the file from the event.
### Supported Variables
| Name | Description |
| ------ | ------------------------------- |
| `path` | Event detected file or dir path |## Limitations
This program has a number of limitations compared to more mature and robust file watching services.
Some of these limitations are by design since this aims to be a "super simple" file watcher.1. Foreground execution only (this was a design choice and will likely not change)
2. Currently, no support for terminating a long-lived program executed by the command. Need to implement some sort of process group management and right now that is out of scope.### Alternatives
For anyone wanting a mature file wathcer, the usual suspects are recommended:
- [watchexec](https://github.com/watchexec/watchexec)
- [Watchman](https://facebook.github.io/watchman/)