Skip to content

aiba/pod-babashka-fswatcher

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

26 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

pod-babashka-fswatcher

A babashka pod for watching files.

Implemented using the Go fsnotify library.

Status

Experimental.

Usage

Load the pod:

(require '[babashka.pods :as pods])
(pods/load-pod 'org.babashka/fswatcher "0.0.2")

(require '[pod.babashka.fswatcher :as fw])

Watchers can be created with fw/watch:

(def watcher (fw/watch "src" (fn [event] (prn event))))

You can create multiple watchers that run concurrently, even on the same directory.

The watch function returns a value which can be passed to unwatch which stops and cleans up the watcher:

(fw/unwatch watcher)

See test/script.clj for an example test script.

Watch recursively

By default watchers do not watch recursively. Pass {:recursive true} in the options map to enable it.

(fw/watch "src" (fn [event] (prn event)) {:recursive true})

Build

Requirements

  • Go 1.15+ should be installed.
  • Clone this repo.
  • Run go build -o pod-babashka-fswatcher main.go to compile the binary.

License

Copyright © 2020 Rahul De and Michiel Borkent

License: BSD 3-Clause

About

Babashka filewatcher pod.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Go 87.8%
  • Clojure 11.2%
  • Shell 1.0%