Reflex - Run a command when files change
reflex [OPTIONS] [COMMAND]
Reflex is a small tool to watch a directory and rerun a command
when certain files change. It's great for automatically running
compile/lint/test tasks and for reloading your application when the code
changes.
- --all=True|False
- Include normally ignored files (VCS and editor special files). Defaults to
False.
- -c,
--config=FILE
- A configuration file that describes how to run reflex (or '-' to read the
configuration from stdin).
- -d,
--decoration=DECORATION
- How to decorate command output. Choices: none, plain, fancy. Default is
plain.
- -g,
--glob=GLOB_LIST
- A shell glob expression to match filenames. (May be repeated.)
- -G,
--inverse-glob=GLOB_LIST
- A shell glob expression to exclude matching filenames. (May be repeated.)
- -R,
--inverse-regex=REGEX
- A regular expression to exclude matching filenames. (May be repeated.)
- --only-dirs=True|False
- Only match directories (not files). Defaults to false.
- --only-files=True|False
- Only match files (not directories). Defaults to false.
- -r,
--regex=REGEX
- A regular expression to match filenames. (May be repeated.)
- -e,
--sequential=True|False
- Don't run multiple commands at the same time. Defaults to false.
- -t,
--shutdown-timeout=TIMEOUT
- Allow services this long to shut down. Defaults to 500ms.
- -s,
--start-service=True|False
- Indicates that the command is a long-running process to be restarted on
matching changes. Defaults to false.
- --substitute=STRING
- The substitution symbol that is replaced with the filename in a command.
Defaults to "{}"
- -v,
--verbose=True|False
- Verbose mode: print out more information about what reflex is doing.
Defaults to false.
Print each .txt file if it changes:
reflex -r '\.txt$' echo {}
Run make(1) if any of the .c files in this directory
change:
Build and run a server; rebuild and restart when .java files
change:
reflex -r '\.java$' -s -- sh -c 'make && java bin/Server'