commands.sh

reflex

all

Watch a directory and rerun a command when certain files change.

More info →

Options (3)

-r, --regexboolean

Compile and run Go application if any `.go` file changes

Example: reflex {{[-r|--regex]}} '{{\.go$}}' {{go run .}}
-G, --inverse-regexboolean

Ignore a directory when watching for changes

Example: reflex {{[-G|--inverse-regex]}} '{{^dir/}}' {{command}}
-s, --start-serviceboolean

Run command when reflex starts and restarts on file changes

Example: reflex {{[-s|--start-service]}} true {{command}}

Examples (5)

Rebuild with `make` if any file changes

Compile and run Go application if any `.go` file changes

reflex [-r|--regex] '\.go$' go run .

Ignore a directory when watching for changes

reflex [-G|--inverse-regex] '^dir/' command

Run command when reflex starts and restarts on file changes

reflex [-s|--start-service] true command

Substitute the filename that changed in

reflex -- echo {}
made by @shridhargupta | data from tldr-pages