Commit Graph

42 Commits

Author SHA1 Message Date
Ryan James Spencer
e90bbcb9bd Support a dedicated ignore file
ref. https://github.com/passcod/cargo-watch/issues/127

This adds support for a dedicated ignore file by the name of `.ignore` a
la `fd`, `ripgrep`, et. al.

This purely just mimics what `Gitignore` is doing except it doesn't
ignore `.git` directories. There might be more I need to tweak and the
interface might be too obtuse, but this is a first pass.

I've also added a `--no-ignore` flag which ignores both `.gitignore` and
the dedicated `.ignore`. It might make sense to add a specific flag that
ignores `.ignore` but respects `.gitignore` to support the old
behaviour, but I wasn't sure what to name it.
2019-10-12 14:13:57 +13:00
SpiralP
dbc52e012e [run] Always canonicalize input paths (#113)
A client may pass non-canonicalized paths into `watch`, and these are therefore not matched against the filters correctly. Thus, some events could call a Handler's `on_update` method even when an ignored file was changed.

See repro: https://github.com/SpiralP/rust-cargo-watch-test

This bug was introduced in aae5a216b0.
2019-03-04 11:40:35 +13:00
Félix Saparelli
5e44cafb94 [windows] Attempt to use tput to clear the screen
In some situations, this may clear the screen better than a call to
`cls`, and in all other cases `cls` is called anyway.

May help #99
2019-01-26 15:22:09 +13:00
Félix Saparelli
6f473bcd87 [meta] Run formatter 2019-01-26 15:15:27 +13:00
Félix Saparelli
aae5a216b0 [api] Make watchexec take a Handler rather than a callback
Instead of special-casing the callback, which is the path least-taken,
switch the internals to a Handler model, where the default behaviour is
an implementation of a Handler, and external callers can implement their
own Handlers and pass them in.

While doing so, change all unwraps in run::run to returning Errs, and
expand the watchexec Error enum to accommodate. That should make it
easier to use as a library.

Also, differentiate between "manual" and "on update" runs. For now the
only manual run is the initial run, but this paves the way for e.g.
keyboard- or signal- triggered runs.
2019-01-26 14:45:13 +13:00
David Ziegler
7b3daeef9c Major changes for c bindings integration as third party crate (see project: github/InfinityMod/watchexec_c).
Changed version to 1.9.3 for third party crate compatibility detection.
2019-01-23 18:56:09 +01:00
Félix Saparelli
a6163cc599 Formatting 2018-09-08 20:08:36 +12:00
Félix Saparelli
21d4080183 Wrap whitespace in arguments
Fixes #82
Fixes #87
2018-08-22 07:15:20 +12:00
Bruce Guenter
1d8d6595e0 Add .pyo to the Python temporary file ignore
Python, when invoked with the -O option, writes compiled code to .pyo
files instead of .pyc. Add this to the default ignores list.
2018-02-08 14:53:12 -06:00
Bruce Guenter
422546b175 Add Emacs temporary files to the default ignored list
Emacs generates temporary backup files while editing named "#FILENAME#"
and ".#FILENAME". Ignore these by default.
2018-02-08 14:53:11 -06:00
Bruce Guenter
c98bea3118 Fix default ignore for vim temporary files
.swp files are created by vim to store editing state while a file is
open. However, it may also create .swo, .swn, etc files if .swp already
exists. Also, the temporary files are always hidden (start with ".").
Finally, vim temporarily creates .swpx files as well which are caught by
inotify.

This change fixes the *.swp pattern to only match hidden files and to
match the other vim temporary files.
2018-02-08 14:53:08 -06:00
Jim McGrath
9b4e74ed30 fix screen clearing on windows 2017-12-06 11:40:04 -06:00
Josh Gao
76d959b27b Use tput reset to clear screen.
Use `tput reset` instead of `clear` so that scrollback is cleared in
addition to the currently visible portion of the terminal.
2017-11-21 00:55:58 -05:00
Matt Green
8770ae3967 Handle relative ignores better? 2017-10-07 15:50:47 -04:00
James Kominick
0e34123023 Add -d, --debounce option
- Add configurable debounce timeout option behind `-d, --debounce`
- Move `-d, --debug` flags to `-v, --verbose`
2017-09-07 19:44:57 -04:00
Matt Green
6ebb7bc7b3 Also ignore changes to ignored dirs themselves 2017-05-10 12:02:49 -04:00
Matt Green
e6de016cb9 Ensure correct path separators are used for VCS ignore dirs 2017-04-27 15:39:12 -04:00
Matt Green
f9a3cade26 Add common VCS dirs to default ignore list (fixes #54) 2017-04-27 15:20:44 -04:00
Les Aker
356dac189d add no-default-ignore option, fixes #45 2017-04-25 21:17:45 -04:00
Matt Green
fe0d5243bd Remove /.* ignore pattern (see #45) 2017-04-25 16:48:44 -04:00
Chris Aumann
a395ed84cd Remove useless format!()
This was a hint by `cargo clippy`
2017-04-10 00:20:57 +02:00
Chris Aumann
df72aaf977 Use if-else statements instead of boolean match
This was a hint by `cargo clippy`
2017-04-10 00:20:57 +02:00
Chris Aumann
780b54b34e Port --no-shell to Windows 2017-04-10 00:20:57 +02:00
Chris Aumann
ee5e93e6af Add support for --no-shell option 2017-04-10 00:19:58 +02:00
Chris Aumann
4763de3790 Re-add --kill flag for compatibility
--kill translates to --signal SIGKILL
2017-04-02 21:21:30 +02:00
Chris Aumann
d5da94fcaf Add check for conflicting --signal and --postpone arguments 2017-04-02 21:21:30 +02:00
Chris Aumann
c98d0e6cfd Decouple --restart and --signal, so they both make sense
This change takes account of the following four use cases:

1. Make sure the previous run was ended, then run the command again (default)
2. Just send a specified signal to the child, do nothing more (--signal given)
3. Send SIGTERM to the child, wait for it to exit, then run the command again (--restart given)
4. Send a specified signal to the child, wait for it to exit, then run the command again (--restart and --signal given)
2017-04-02 21:21:30 +02:00
Chris Aumann
3a5ff290d5 Use a more idiomatic way to set --signal 2017-04-02 21:19:53 +02:00
Chris Aumann
68caf04269 First commit to add a generic --signal flag 2017-04-02 21:19:52 +02:00
Matt Green
125e7eb7c8 rustfmt & clippy fixes 2017-02-04 16:26:59 -05:00
Matt Green
e16a6b3a24 Support watching multiple paths 2017-02-04 16:18:02 -05:00
Matt Green
53c1f39919 Load + handle multiple .gitignore files in project dir 2017-02-04 14:53:27 -05:00
Matt Green
b2b0a60ca5 Add -1 option for integration testing, closes #35 2017-01-27 15:27:44 -05:00
Matt Green
fd2d6e364a Add -k to support sending SIGKILL 2017-01-16 14:18:38 -05:00
Matt Green
171132a722 rustfmt & clippy fixes 2016-12-20 12:20:21 -05:00
Matt Green
9c65e816da Add -k option to send SIGKILL instead of SIGTERM; closes #31 2016-12-19 11:37:20 -05:00
Matt Green
f768721ca3 Remove --watch option, always watch cwd 2016-11-17 08:45:55 -05:00
Matt Green
8f916c495f Apply clippy suggested fixes 2016-10-30 12:37:34 -04:00
Matt Green
69eedd4cc5 rustfmt fixes 2016-10-30 12:28:54 -04:00
Matt Green
85f0a4aaaf Make --run-initially default, add --postpone flag to disable 2016-10-29 10:43:45 -04:00
Matt Green
9652aeb837 Fix dotted dir default filter to only fire on dirs 2016-10-29 10:21:04 -04:00
Matt Green
f04083a21d Use Process & ProcessReaper to handle async process waiting 2016-10-26 11:02:04 -04:00