Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/freref/fzwatch
A lightweight and cross-plotform file watcher for your Zig projects.
https://github.com/freref/fzwatch
zig-package
Last synced: 14 days ago
JSON representation
A lightweight and cross-plotform file watcher for your Zig projects.
- Host: GitHub
- URL: https://github.com/freref/fzwatch
- Owner: freref
- License: mit
- Created: 2024-11-03T22:33:03.000Z (3 months ago)
- Default Branch: master
- Last Pushed: 2024-11-04T22:16:38.000Z (3 months ago)
- Last Synced: 2024-11-04T23:17:39.869Z (3 months ago)
- Topics: zig-package
- Language: Zig
- Homepage:
- Size: 12.7 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# fzwatch
A lightweight and cross-platform file watcher for your Zig projects.
> [!NOTE]
> This project exists to support [fancy-cat](https://github.com/freref/fancy-cat) and has limited features.## Instructions
### Run example
You can run the [examples](./examples/) like so:
```sh
zig build run-
```
### Usage
A basic example can be found under [examples](./examples/basic.zig). The API is defined as follows:
```zig
pub const Event = enum { modified };
pub const Callback = fn (context: *anyopaque, event: Event) void;
pub const Opts = struct { latency: f16 = 1.0 };
pub fn init(allocator: std.mem.Allocator) !Watcher;
pub fn deinit(self: *Watcher) void;
pub fn addFile(self: *Watcher, path: []const u8) !void;
pub fn removeFile(self: *Watcher, path: []const u8) !void;
pub fn setCallback(self: *Watcher, callback: Callback) void;
pub fn start(self: *Watcher, opts: Opts) !void;
pub fn stop(self: *Watcher) !void;
````