No description
- TypeScript 97.8%
- Shell 2.2%
| Filename | Latest commit message | Latest commit date |
|---|---|---|
| s | ||
| src | ||
| .gitignore | ||
| .nvmrc | ||
| .prettierrc | ||
| package-lock.json | ||
| package.json | ||
| README.txt | ||
| runchanges | ||
| tsconfig.json | ||
| UNLICENSE | ||
USAGE: runchanges [OPTIONS] [--] CMD [ARGS ...]
A tool to run and re-run a command when files have changed.
Options:
-h | --help Show this help message
-l NUM | --limit NUM (default: 4096). Set NUM as an upper limit for the
number of files to watch.
-d MS | --delay MS (default: 100). Wait MS milliseconds before re-
running CMD.
-w PATH | --watch PATH Watch PATH for changes. If PATH is plain file, it
will be watched. If PATH is a directory, all files
it contains (recursively) will be watched.
-- Separator to stop processing further arguments.
Operation:
When first launched, runchanges will execute CMD with the provided ARGS
and no additional arguments.
When any watched files have changed, runchanges will execute CMD with
the provided ARGS and one additional argument for each file that has
changed. Each additional argument will be prefixed with either a '+',
'*', or '*' character, followed by a ':' character, followed by the path
to the file that has changed.
The prefix is determined based on the kind of change:
'+' means the file was newly created
'*' means the file was altered (based on mtime)
'-' means the file was deleted
Only one child CMD is executed at a time. The exit code is ignored.
If file changes are detected while CMD is running, CMD will be re-run with
those file changes after the configurable delay.
Sending SIGINT to runchanges will stop listening for files. If CMD is
running, a message will be printed indicating that a sub-command is running,
and it will exit when CMD exits. Any additional SIGINTs sent while witing
for CMD to finish will be sent to the CMD process.
Sending SIGUSR1 to runchanges will print all of the files that are being
watched, one per line.
Example:
$ mkdir ./src
$ echo preexisting > ./src/preexisting
$ runchanges -w ./src -- echo "Changes:"
This command will immediately run ["echo", "Changes:"]` (printing to the
terminal), and wait for changes to any files in the ./src directory.
If you then in the same directory were to run:
$ echo addition >> ./src/preexisting
The command, after a delay of 100 milliseconds, would run:
["echo", "Changes:", "*:./src/preexisting] (again printing to the
terminal) and wait for changes to any files in the ./src directory.
If you then in the same directory were to run:
$ echo newfile > ./src/newfile && rm ./src/preexisting
The command, after a delay of 100 milliseconds, would run:
["echo", "Changes:", "+:./src/newfile", "-:./src/preexisting"]