Executes commands in response to file modifications
APACHE-2.0 License
Bot releases are visible (Hide)
--watch-file
(#849)Published by github-actions[bot] 6 months ago
-w, --watch
was accidentally set to behave as -W
(#828)Published by github-actions[bot] 6 months ago
-W
, --watch-non-recursive
for watching paths without also watching subfolders..git
is a file rather than a folder)Published by github-actions[bot] 6 months ago
This is the first breaking release. Most of it is cleaning up a number of deprecated options, and changing some defaults. The idea, however, is to start a new era of Watchexec releases, where breaking changes are allowed more easily (to give an idea of how breaking-change-averse the project has been: this release was planned in January 2022! and ever-delayed since).
Fear not! The cadence of breaking releases will be at most once or twice a year, and whenever possible a deprecation will precede a break by at least three months. Watchexec will remain a stable part of your workflow, while allowing ourselves some evolution.
$SHELL
when it is present. (#210)--shell=sh
to switch back if your $SHELL
is something else.--shell=cmd
to switch back to CMD.EXE, or set the SHELL
environment variable.--on-busy-update
defaults to do-nothing
now (was queue
).-W
/ --watch-when-idle
is removed, as it is now the default.--stop-timeout
is now 10 seconds.--debounce
, --delay-run
, --poll
, and --stop-timeout
now prefer durations with a unit, and warn if given unit-less durations. The default units for these are millisecond for --debounce
and --poll
, and seconds for --delay-run
and --stop-timeout
, which is a source of confusion. Unit-less durations will be removed in a future breaking release.--no-shell
is removed.--shell=none
instead. The -n
short option remains as an alias to --shell=none
.-k
/ --kill
is removed.--signal=KILL
instead.--changes-only
is removed.--print-events
instead.--emit-events-to
defaults to none
, and the environment
mode is deprecated.--emit-events-to
no longer accepts stdin
(deprecated alias for stdio
) and json-stdin
(deprecated alias for json-stdio
).--no-ignore
is removed.--no-project-ignore
instead.--no-environment
is deprecated.--clear=reset
will reset the screen on graceful shutdown. (#797)--no-process-group
is deprecated.WATCHEXEC_FILTERER
environment variable.--wrap-process=MODE
lets you choose between using process groups, process sessions, or nothing at all. (#794)WATCHEXEC_TMPDIR
environment variable can be used to customize where Watchexec will write temporary files, if for some reason your $TMPDIR
is unwritable. (#814)As a treat, this release also features an experimental new option: -j
or --filter-prog
, which lets you write filter programs.
-j
, --filter-prog EXPRESSION
Provide your own custom filter programs in jaq (similar to jq) syntax. Programs are given an event in the same format as described in --emit-events-to
and must return a boolean. In addition to the jaq stdlib, watchexec adds some custom filter definitions:
path | file_meta
returns file metadata or null if the file does not exist.path | file_size
returns the size of the file at path, or null if it does not exist.path | file_read(bytes)
returns a string with the first n bytes of the file at path. If the file is smaller than n bytes, the whole file is returned. There is no filter to read the whole file at once to encourage limiting the amount of data read and processed.string | hash
, and path | file_hash
return the hash of the string or file at path. No guarantee is made about the algorithm used: treat it as an opaque value.any | kv_store(key)
, kv_fetch(key)
, and kv_clear
provide a simple key-value store. Data is kept in memory only, there is no persistence. Consistency is not guaranteed.any | printout
, any | printerr
, and any | log(level)
will print or log any given value to stdout, stderr, or the log (levels = error, warn, info, debug, trace), and pass the value through (so [1] | log("debug") | .[]
will produce a 1
and log [1]
).All filtering done with such programs, and especially those using kv or filesystem access, is much slower than the other filtering methods. If filtering is too slow, events will back up and stall watchexec. Take care when designing your filters.
If the argument to this option starts with an '@', the rest of the argument is taken to be the path to a file containing a jaq program.
Jaq programs are run in order, after all other filters, and short-circuit: if a filter (jaq or not) rejects an event, execution stops there, and no other filters are run. Additionally, they stop after outputting the first value, so you'll want to use 'any' or 'all' when iterating, otherwise only the first item will be processed, which can be quite confusing!
Regexp ignore filter on paths:
all(.tags[] | select(.kind == "path"); .absolute | test("[.]test[.]js$")) | not
Pass any event that creates a file:
any(.tags[] | select(.kind == "fs"); .simple == "create")
Pass events that touch executable files:
any(.tags[] | select(.kind == "path" && .filetype == "file"); .absolute | metadata | .executable)
Ignore files that start with shebangs:
any(.tags[] | select(.kind == "path" && .filetype == "file"); .absolute | read(2) == "#!") | not
More examples can be found and contributed in the discussion thread
Published by github-actions[bot] 10 months 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 github-actions[bot] 10 months 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 github-actions[bot] 10 months 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 github-actions[bot] 10 months ago
Software development often involves running the same commands over and over. Boring! Watchexec is a 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
.
@argfile
arguments were parsed from beyond the --
separator. (#717, #720)Published by github-actions[bot] 11 months 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
.
--colour=never
(--color
also accepted) to disable, or the conventional always
and auto
. (#144, #237, #698)--timings
to print how long the command took. (#278, #698)--quiet
to disable printing any message (except warning and error logs). (#698)--bell
to ring the terminal bell on command end. (#238, #698)--ignore-nothing
to switch on all the --no-*-ignore
flags. (#275, #625, #695)--only-emit-events
disables launching a command, and only prints events to stdout. Requires --emit-events-to
to specify the format to print. This lets you obtain a stream of change events to handle directly rather than mediating via a command. (#676, #691)--map-signal
to map signals received by Watchexec to other signals sent to the command. (#151, #387, #710)--emit-events-to
stdin
and json-stdin
modes are renamed to stdio
and json-stdio
respectively; the old names are aliased to preserve compatibility.-w /dev/null
disables watching any files. This is the literal string /dev/null
, it won't detect the null device via links or fifos. (#601)command-group
5). (#601)notify
6). (#601)--print-events
and --clear
can meaningfully be used together. (#601)--help
and short -h
flags. (#601)Published by github-actions[bot] about 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
.
--no-project-ignore
, --no-global-ignore
are given respectively (#644, #643)--no-discover-ignore
which implies --no-project-ignore
, --no-global-ignore
, and --no-vcs-ignore
and completely disables ignore discovery — useful on very large repos (#645)-d
short flag (for --debounce
) which got removed by accident (#635)Published by github-actions[bot] 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 github-actions[bot] 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 github-actions[bot] 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
.
--restart
and --stop-timeout
(#544, #548)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 github-actions[bot] about 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
.
v1.2.3
, all other crates are strictly {crate-name}-v1.2.3
. Historical tag names are preserved as aliases.Published by github-actions[bot] about 2 years ago
Published by github-actions[bot] over 2 years ago
Published by github-actions[bot] over 2 years ago