Skip to content

lunyav/zigmon

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Zig bindings for the C library dmon.

Getting started

zig fetch --save git+https://github.com/OsakiTsukiko/zigmon

Then in your build.zig add:

const zigmon = b.dependency("zigmon", .{});
exe.root_module.addImport("zigmon", zigmon.module("zigmon"));

Example Code

const std = @import("std");
const zm = @import("zigmon");

const Watcher = zm.Watcher(i64);

fn on_change(watcher: Watcher, _: zm.Action, _: []const u8, _: ?[]const u8) void {
    std.debug.print("\nSomething happened ({}):\n", .{watcher.data});
}

pub fn main() !void {
    zm.init();
    defer zm.deinit();

    var my_watcher: Watcher = .{
        .root = ".",
        .data = 1337,

        .on_change = on_change,
    };
    try my_watcher.watch();
    defer my_watcher.unwatch();
}

Demos

# Will run src/demos/main.zig (wrapper)
zig build demo

# Will run src/demos/raw.zig (native)
zig build demo-raw

Useful

To better understand how to use, look into src/demos/main.zig and src/demos/raw.zig (for the raw version of this binding).

Note: Used by Makko

About

Zig asynchronous directory file change watcher library for Windows, macOS and Linux.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages

  • C 88.5%
  • Zig 11.5%