Executes commands in response to file modifications
APACHE-2.0 License
Bot releases are hidden (Show)
Published by passcod over 1 year ago
Software development often involves running the same commands over and over. Boring! Watchexec is a simple, standalone tool that watches a path and runs a command whenever it detects modifications. Install it today with cargo-binstall watchexec-cli
, from the binaries below, find it in your favourite package manager, or build it from source with cargo install watchexec-cli
.
--emit-events-to <mode>
provides alternative ways to receive event details. To the environment
mode, equivalent to the previous behaviour (and still the default), the file
, stdin
, json-file
, and json-stdint
modes are added. The watchexec-events crate can be used to parse the JSON format from Rust programs.--fs-events <events>
provides a more flexible way to filter which kinds of filesystem events cause command runs. The --no-meta
option is now an alias to the configuration of this method omitting metadata changes.--clear=reset
performs a stronger screen clear (roughly equivalent to a tput reset
).--manual
shows the manual page, --help
shows extended help (-h
shows short help), --completion <shell>
prints a completion script, such that even installing from source can benefit from the manpage or completions.--filter-file
and --ignore-file
provide ways to load arbitrary ignore files, and also "filter files", which should be formatted like ignore files but patterns are treated the same as --ignore
patterns.--stop-signal
lets you override the signal used to stop the process during a restart.--stop-timeout
lets you override the time waited between sending a signal and killing the process (which defaults to 30 seconds).--log-file
's path argument is now optional. Providing the bare --log-file
option uses the current directory. Further, the option also accepts a directory instead of a file, in which case it will create a file named watchexec.<timestamp>.log
there.--poll
is the new name for --force-poll
(the old name exists as an alias), and the polling interval is now optional, with a default provided if no value is given.2mins 30s
. This is a very similar format as systemd's durations, implemented by the humantime crate.--version
option now prints extended version information, including the build date and commit hash (where that information is available). This is powered by a new crate, bosion.Published by passcod over 1 year ago
Software development often involves running the same commands over and over. Boring! Watchexec is a simple, standalone tool that watches a path and runs a command whenever it detects modifications. Install it today with cargo-binstall watchexec-cli
, from the binaries below, find it in your favourite package manager, or build it from source with cargo install watchexec-cli
.
Published by passcod almost 2 years ago
Software development often involves running the same commands over and over. Boring! Watchexec is a simple, standalone tool that watches a path and runs a command whenever it detects modifications. Install it today with cargo-binstall watchexec-cli
, from the binaries below, find it in your favourite package manager, or build it from source with cargo install watchexec-cli
.
--stdin-quit
makes watchexec exit when STDIN closes, which avoids zombies when running with Elixir. (#440, #449)Published by passcod over 2 years ago
--restart
(#346, #353)--signal
with --restart
(#353)-v
(info) more useful with actual, but sparse, information (#260, #354)Published by passcod over 2 years ago
--help
warnings when running or building with non-standard options (#348)--exts
, as a "path fragment") (#345, #349, #350)Published by passcod over 2 years ago
Yanked on 2022-06-29
-E
flag would accept but silently discard invalid UTF-8, now watchexec errors on such input. (#317)--log-file
option makes it easier to collect logs without polluting the screen. (#321)--delay-run
option adds a configurable sleep before running the command. A native, cross-platform alternative to sleep N; command...
! (#79)Additionally, some repo changes:
main
is not allowed.Not directly related to the CLI, but the library 2.0.0 version has now been released as stable! Full semver applies again.
Known issue with some packages: DEB and RPM packages may be missing dependencies due to being auto-generated instead of lovingly handcrafted. Prefer distributions from packagers rather than these ones, which are just provided on an ad-hoc, if convenient, as-is, basis.
Published by passcod over 2 years ago
--shell
default will be changing on Unix (#210).--project-origin
provides an override which can be useful when the project origin is misdetected, or if you want to stop watchexec from looking for ignore files in (some) parent directories (#246).--workdir
sets the command's working directory independent of Watchexec's.--env
(short: -E
) adds environment variables to the command without affecting Watchexec itself.Published by passcod over 2 years ago
Published by passcod over 2 years ago
Published by passcod over 2 years ago
Published by passcod over 2 years ago
.
when no -w
are passed. (#270)Published by passcod over 2 years ago
Published by passcod over 2 years ago
Revert backend switch on mac from previous release. We'll do it a different way later (#269)
Published by passcod over 2 years ago
Watchexec::new()
now reports the library's version at debug level=
) requirement, to avoid breakage (#266)Published by passcod over 2 years ago
error::FsWatcherError
enum split off from RuntimeError
, and with additional variants to take advantage of targeted help text for known inotify errors on Linuxextensions
and filters
are now cooperative rather than exclusionary. That is, a filters of ["Gemfile"]
and an extensions of ["js", "rb"]
will match both Gemfile
and index.js
rather than matching nothing at all. This restores pre 2.0 behaviour.*/file
will match both file
and dir/file
instead of just dir/file
. This is a compatibility fix and is incorrect behaviour which will be removed in the future. Do not rely on it.Published by passcod over 2 years ago
on_error
handler gets an upgraded parameter which lets it upgrade (runtime) errors to critical.summarize_events_to_paths
now deduplicates paths within each variable.Published by passcod over 2 years ago
Action
, PreSpawn
, and PostSpawn
structs passed to handlers now contain an Arc<[Event]>
instead of an Arc<Vec<Event>>
Outcome
processing (the final bit of an action) now runs concurrently, so it doesn't block further event processing (#247, and to a certain extent, #241)Published by passcod over 2 years ago
Published by passcod over 2 years ago
Yanked for critical bug in globset (fixed in pre.8) on 2022-01-26
filter::check_glob
and error::GlobParseError
Published by passcod almost 3 years ago
This is the first release built on top of Watchexec library 2.0. Any change in behaviour other than listed below is a bug.
-v
, -vv
… up to -vvvv
printing increasingly more logs. Note that -v
already prints a lot more logs than in previous releases, and that the log format has changed. Additionally, the RUST_LOG
environment variable can be set for even finer-grained logging.--changes-only
was renamed to --print-events
, and its output changed. The former option persists as an alias for compatibility but will be removed eventually.--no-ignore
was renamed to --no-project-ignore
for clarity. The former option persists as an alias for compatibility but will be removed eventually.[[Command exited with 63]]
) (#37)--notify
/ -N
option now works properly, and is therefore out of experimental.~/.gitignore
, ~/.bazaar/ignore
) (#58)core.excludesFile
).git/info/exclude
)~/.config/watchexec/ignore
or as system-appropriateWATCHEXEC_IGNORE_FILES
environment variable (format is as for the system PATH
variable)WATCHEXEC_COMMON_PATH
is always set, with the common prefix of all pathsWATCHEXEC_OTHERWISE_CHANGED_PATH
is new, for event kinds not covered by the other five (CREATED
, META_CHANGED
, REMOVED
, RENAMED
, WRITTEN
)Note that this release is not coincidental with the stable release of the library 2.0, which is still "in preview."
When installing from the DEB packages, a prior version may need to be uninstalled first, see #233.
Set WATCHEXEC_FILTERER=tagged
to opt into a new filter engine. This will disable the -e
/ --exts
and -i
/ --ignore
options and change the -f
/ --filter
option to accept a "tagged filter" instead.
Documentation is available at: https://docs.rs/watchexec/2.0.0-pre.6/watchexec/filter/tagged/struct.TaggedFilterer.html
For example, this set of filters:
path=data/*.json
path*!test-*
kind=Create(*)
would only allow file creation events from JSON files in data/
except those starting with test-
.
There are 8 "tags" that can be matched upon, including path
, kind
(of the event: creates, modifies, metadata, etc), type
(of the path that was changed: file, folder, link, etc). There is a variety of operators: glob (*=
and *!
), exact (==
and !=
), sets (:=
and :!
), and regex (~=
and ~!
). The shorthand =
operator resolves to the "most useful" operator for the tag being matched (currently *=
for path
, kind
, and exit
, :=
otherwise). This provides a lot more power and flexibility, but does make filtering less intuitive — ideas are welcome on improvements.
The tagged filterer also solves the current filterer's main confusing issue: folder filtering. path=folder/
and path!*folder/
will do the expected thing, instead of requiring obscure forms like **/folder/**
.
Using the --filter-file
/ -F
option, one or more "tagged filter files" can be loaded, with every filter on a new line. Blank lines and lines starting with #
are ignored. Like for ignore files, the WATCHEXEC_FILTER_FILES
envvar is also consulted, and the ~/.config/watchexec/filter
global filter file applies if present (or in system-relevant location). There is no default project-local filter file.
This mode is experimental: it is not to be considered stable in any way. Using it will print a warning message when watchexec starts. The aim is to have it become good enough so it can be the default in a future breaking release (but not 2.0, which will instead focus on other long-standing issues which aren't as earth-shattering as this), or to use its ideas to improve the existing implementation, whichever ends up better for everyone!
This release comes with special thanks to Radon Rosborough, supporting me via Ko-fi.