paulsmith / reloader.sh

automatically trigger a reload of a process when a file change is detected

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Usage:

  $ reloader.sh [-e pat] [-d dir] [-h] buildcmd [runcmd]
  
By default it watches for file system events in the current working
directory. `buildcmd` is the command you want to run (i.e., re-run) each time
a change is detected. `runcmd` is an optional second command to run after the
`buildcmd` completes successfully, for example, compiling a binary and then
running it as a server process.

Options:

  -e pat        exclude path matching this regex pattern from watch detection
  -d dir        watch this directory only
 
Options -e and -d can be given multiple times.

Installation:

Copy it to your $PATH. The file change monitor fswatch[1] is a dependency.
  
Examples:

  Go:

    $ reloader.sh "go run main.go"
    $ reloader.sh -e .git "go run main.go"
    $ reloader.sh "go build -o app ." ./app

  Rust:

    $ reloader.sh "cargo run"
    $ reloader.sh "cargo build" ./target/debug/hello
    $ reloader.sh -d src "cargo run"

  Zig:

    $ reloader.sh "zig build-exe hello.zig" ./hello
    $ reloader.sh -d src "zig build run"

[1]: https://emcrisostomo.github.io/fswatch/

About

automatically trigger a reload of a process when a file change is detected

License:MIT License


Languages

Language:Shell 81.6%Language:Nix 18.4%