watchexec ~fix-filter-be-additive
monitor a filesystem for changes to execute a command
To use this package, run the following command in your project's root directory:
Manual usage
Put the following dependency into your project's dependences section:
watchexec
watchexec is a simple, standalone program that watches a path for changes and runs a command when it detects any modifications.
Features
- simple invocation and use
- monitors one or more root directories recursively for changes
- support watching only files with specific file extensions
- automatically uses ignores from
.gitignore
- if it doesn't exists then default ignores are used if not instructed to do otherwise
- optionally send a desktop notification with the exit code from the command
- requires that the command
notify-send
is installed
- requires that the command
- optionally clears the screen between executing the command
- optinally restart the command if it is already executing when a modification is detected
- optionally watch for metadata changes.
- sandbox feature which mean that when a process is terminated it also mean that all its children are killed
- sets the following environment variables in the child process when
--env
is used:$WATCHEXEC_EVENT
is a tuple of values "event type":"path"- If multiple files changed then the events are separated by ";"
- oneshot mode wherein watchexec compare the files on disk to a json database and only execute the command if the files have changed.
Usage Examples
A generic project that must first build the program before the test suite can execute.
$ watchexec -w src --shell -- "make all && make test"
If you are a D developer that wants to execute your tests.
$ watchexech -w source -- dub test
Getting Started
watchexec depends on the following software packages:
- D compiler (dmd 2.079+, ldc 1.11.0+)
It is recommended to install the D compiler by downloading it from the official distribution page.
# link https://dlang.org/download.html
curl -fsS https://dlang.org/install.sh | bash -s dmd
Then you can run watchexec via dub:
dub run watchexec
alternatively you can clone the repo and build it yourself.
git clone https://github.com/joakim-brannstrom/watchexec.git
cd watchexec
dub build -b release
Done! Have fun. Don't be shy to report any issue that you find.
Credit
This is a basically a re-implementation of watchexec. I had for a long time been using inotifywait in custom bash scripts but the rust version of watchexec where actually better.
- Registered by Joakim Brännström
- ~fix-filter-be-additive released 3 years ago
- joakim-brannstrom/watchexec
- BSL-1.0
- Copyright © 2020, Joakim Brännström
- Authors:
- Dependencies:
- colorlog, proc, my, sumtype
- Versions:
-
1.0.1 2024-Mar-26 1.0.0 2022-Jun-15 0.0.15 2021-Oct-12 0.0.13 2021-May-18 0.0.12 2021-May-14 - Download Stats:
-
-
0 downloads today
-
0 downloads this week
-
0 downloads this month
-
39 downloads total
-
- Score:
- 1.2
- Short URL:
- watchexec.dub.pm